SST  14.0.0
StructuralSimulationToolkit
profiletool.h
1 // Copyright 2009-2024 NTESS. Under the terms
2 // of Contract DE-NA0003525 with NTESS, the U.S.
3 // Government retains certain rights in this software.
4 //
5 // Copyright (c) 2009-2024, NTESS
6 // All rights reserved.
7 //
8 // This file is part of the SST software package. For license
9 // information, see the LICENSE file in the top level directory of the
10 // distribution.
11 
12 #ifndef SST_CORE_PROFILE_PROFILETOOL_H
13 #define SST_CORE_PROFILE_PROFILETOOL_H
14 
15 #include "sst/core/eli/elementinfo.h"
16 #include "sst/core/sst_types.h"
17 #include "sst/core/warnmacros.h"
18 
19 namespace SST {
20 
21 class Params;
22 
23 namespace Profile {
24 
25 /**
26  ProfileTool is a class loadable through the factory which allows
27  dynamic addition of profiling capabililites to profile points.
28 */
30 {
31 
32 public:
33  SST_ELI_DECLARE_BASE(ProfileTool)
34  // maybe declare extern to limit compile times??
35  SST_ELI_DECLARE_CTOR_EXTERN(const std::string&, Params&)
36  SST_ELI_DECLARE_INFO_EXTERN(
39 
40  ProfileTool(const std::string& name);
41 
42  virtual ~ProfileTool() {}
43 
44  std::string getName() { return name; }
45 
46  virtual void outputData(FILE* fp) = 0;
47 
48 protected:
49  const std::string name;
50 };
51 
52 } // namespace Profile
53 } // namespace SST
54 
55 // Register profile tools. Must register an interface
56 // (API) first, then you can register a subcomponent that implements
57 // it
58 #define SST_ELI_REGISTER_PROFILETOOL_API(cls, ...) \
59  SST_ELI_DECLARE_NEW_BASE(SST::Profile::ProfileTool,::cls) \
60  SST_ELI_NEW_BASE_CTOR(const std::string&,##__VA_ARGS__)
61 
62 #define SST_ELI_REGISTER_PROFILETOOL_DERIVED_API(cls, base, ...) \
63  SST_ELI_DECLARE_NEW_BASE(::base,::cls) \
64  SST_ELI_NEW_BASE_CTOR(const std::string&,##__VA_ARGS__)
65 
66 #define SST_ELI_REGISTER_PROFILETOOL(cls, interface, lib, name, version, desc) \
67  SST_ELI_REGISTER_DERIVED(::interface,cls,lib,name,ELI_FORWARD_AS_ONE(version),desc) \
68  SST_ELI_INTERFACE_INFO(#interface)
69 
70 #endif // SST_CORE_SUBCOMPONENT_H
Definition: action.cc:18
ProfileTool is a class loadable through the factory which allows dynamic addition of profiling capabi...
Definition: profiletool.h:29
Definition: paramsInfo.h:40
Parameter store.
Definition: params.h:55
Definition: interfaceInfo.h:18