src/hotspot/share/gc/shared/weakProcessorPhaseTimes.hpp
changeset 53536 482109fae02b
parent 51546 b9f6a4427da9
child 57828 35db8fba55f9
equal deleted inserted replaced
53535:ce77e4d928f3 53536:482109fae02b
     1 /*
     1 /*
     2  * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    31 #include "utilities/ticks.hpp"
    31 #include "utilities/ticks.hpp"
    32 
    32 
    33 template<typename T> class WorkerDataArray;
    33 template<typename T> class WorkerDataArray;
    34 
    34 
    35 class WeakProcessorPhaseTimes : public CHeapObj<mtGC> {
    35 class WeakProcessorPhaseTimes : public CHeapObj<mtGC> {
       
    36   enum {
       
    37     DeadItems,
       
    38     TotalItems
       
    39   };
    36   uint _max_threads;
    40   uint _max_threads;
    37   uint _active_workers;
    41   uint _active_workers;
    38 
    42 
    39   // Total time for weak processor.
    43   // Total time for weak processor.
    40   double _total_time_sec;
    44   double _total_time_sec;
    41 
    45 
    42   // Total time for each serially processed phase.  Entries for phases
    46   // Total time for each serially processed phase.  Entries for phases
    43   // processed by multiple threads are unused, as are entries for
    47   // processed by multiple threads are unused, as are entries for
    44   // unexecuted phases.
    48   // unexecuted phases.
    45   double _phase_times_sec[WeakProcessorPhases::phase_count];
    49   double _phase_times_sec[WeakProcessorPhases::phase_count];
       
    50   size_t _phase_dead_items[WeakProcessorPhases::phase_count];
       
    51   size_t _phase_total_items[WeakProcessorPhases::phase_count];
    46 
    52 
    47   // Per-worker times, if multiple threads used and the phase was executed.
    53   // Per-worker times and linked items, if multiple threads used and the phase was executed.
    48   WorkerDataArray<double>* _worker_phase_times_sec[WeakProcessorPhases::oop_storage_phase_count];
    54   WorkerDataArray<double>* _worker_data[WeakProcessorPhases::oop_storage_phase_count];
       
    55   WorkerDataArray<size_t>* _worker_dead_items[WeakProcessorPhases::oop_storage_phase_count];
       
    56   WorkerDataArray<size_t>* _worker_total_items[WeakProcessorPhases::oop_storage_phase_count];
    49 
    57 
    50   WorkerDataArray<double>* worker_data(WeakProcessorPhase phase) const;
    58   WorkerDataArray<double>* worker_data(WeakProcessorPhase phase) const;
    51 
    59 
    52   void log_st_phase(WeakProcessorPhase phase, uint indent) const;
    60   void log_st_phase(WeakProcessorPhase phase, uint indent) const;
    53   void log_mt_phase_summary(WeakProcessorPhase phase, uint indent) const;
    61   void log_mt_phase_summary(WeakProcessorPhase phase, uint indent) const;
    54   void log_mt_phase_details(WeakProcessorPhase phase, uint indent) const;
    62   template <typename T>
       
    63   void log_mt_phase_details(WorkerDataArray<T>* data, uint indent) const;
    55 
    64 
    56 public:
    65 public:
    57   WeakProcessorPhaseTimes(uint max_threads);
    66   WeakProcessorPhaseTimes(uint max_threads);
    58   ~WeakProcessorPhaseTimes();
    67   ~WeakProcessorPhaseTimes();
    59 
    68 
    65   double phase_time_sec(WeakProcessorPhase phase) const;
    74   double phase_time_sec(WeakProcessorPhase phase) const;
    66   double worker_time_sec(uint worker_id, WeakProcessorPhase phase) const;
    75   double worker_time_sec(uint worker_id, WeakProcessorPhase phase) const;
    67 
    76 
    68   void record_total_time_sec(double time_sec);
    77   void record_total_time_sec(double time_sec);
    69   void record_phase_time_sec(WeakProcessorPhase phase, double time_sec);
    78   void record_phase_time_sec(WeakProcessorPhase phase, double time_sec);
       
    79   void record_phase_items(WeakProcessorPhase phase, size_t num_dead, size_t num_total);
    70   void record_worker_time_sec(uint worker_id, WeakProcessorPhase phase, double time_sec);
    80   void record_worker_time_sec(uint worker_id, WeakProcessorPhase phase, double time_sec);
       
    81   void record_worker_items(uint worker_id, WeakProcessorPhase phase, size_t num_dead, size_t num_total);
    71 
    82 
    72   void reset();
    83   void reset();
    73 
    84 
    74   void log_print(uint indent = 0) const;
    85   void log_print(uint indent = 0) const;
    75   void log_print_phases(uint indent = 0) const;
    86   void log_print_phases(uint indent = 0) const;