Panzer  Version of the Day
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Panzer_PAPI_Counter.hpp
Go to the documentation of this file.
1 // @HEADER
2 // *****************************************************************************
3 // Panzer: A partial differential equation assembly
4 // engine for strongly coupled complex multiphysics systems
5 //
6 // Copyright 2011 NTESS and the Panzer contributors.
7 // SPDX-License-Identifier: BSD-3-Clause
8 // *****************************************************************************
9 // @HEADER
10 
11 #ifndef PANZER_PAPI_COUNTER_HPP
12 #define PANZER_PAPI_COUNTER_HPP
13 
14 #include <string>
15 #include <map>
16 #include <mpi.h>
17 
18 namespace panzer {
19 
20  class PAPICounter {
21 
22  struct InternalCounter {
24  long long int rcy;
25  long long int rus;
26  long long int ucy;
27  long long int uus;
28 
29  long int rt_rus;
30  long int rt_ins;
31  long int rt_fp;
32  long int rt_dcm;
33 
35  hw_counters(0),
36  rcy(0),
37  rus(0),
38  ucy(0),
39  uus(0),
40  rt_rus(0),
41  rt_ins(0),
42  rt_fp(0),
43  rt_dcm(0)
44  { }
45 
46  };
47 
48  public:
49 
50  PAPICounter(const std::string, const int my_rank, MPI_Comm comm);
51 
52  void start();
53 
54  void stop();
55 
56  void report(std::ostream& os);
57 
58  private:
59 
61  static std::map<std::string,InternalCounter> m_counters;
62  std::string m_name;
63  int m_rank;
64  MPI_Comm m_comm;
65 
66  };
67 
68 }
69 
70 #endif
void report(std::ostream &os)
PAPICounter(const std::string, const int my_rank, MPI_Comm comm)
static std::map< std::string, InternalCounter > m_counters
dangerous in a multithreaded world!