InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
PerformanceStats.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: jshankar
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // ADOBE CONFIDENTIAL
16 //
17 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
18 //
19 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
20 // with the terms of the Adobe license agreement accompanying it. If you have received
21 // this file from a source other than Adobe, then your use, modification, or
22 // distribution of it requires the prior written permission of Adobe.
23 //
24 //
25 // Contains API for getting performance statistics.
26 //
27 //========================================================================================
28 
29 #ifndef __PerformanceStats__
30 #define __PerformanceStats__
31 
32 #include "OMTypes.h"
33 #include "IPerformanceMetric.h"
34 
36 {
37 public:
38  enum EDoWhat { eGetValue, eResetValue /* if applicable */};
39 
40  typedef uint64 (*CallBack)(EDoWhat doWhat, void *refPtr, PerformanceMetricID counter);
41 
42  static uint64 GetValue(PerformanceMetricID counter);
43  static void ResetValue(PerformanceMetricID counter);
44 
45  static void RegisterCounter(PerformanceMetricID counter, CallBack callback, void* refPtr, const PMString &shortName, const PMString &longName);
46  static void RegisterCounter(PerformanceMetricID counter, ClassID counterProvider, const PMString &shortName, const PMString &longName);
47 
48  static void DeRegisterCounter(PerformanceMetricID counter);
49 
50 
51  static void GetAllMetricIDs(IPerformanceMetric::PerformanceMetricIDList &metrics);
58  static PMString GetMetricLongName(PerformanceMetricID counter);
59  static void Startup();
60  static void Shutdown();
61 };
62 
64 {
65 public:
66  StaticPerfCallbackRegister(PerformanceMetricID counter, PerformanceStats::CallBack callback, void* refPtr, const PMString &shortName, const PMString &longName) :
67  fCounterID(counter)
68  {
69  PerformanceStats::RegisterCounter(counter, callback, refPtr, shortName, longName);
70  }
72  {
73  PerformanceStats::DeRegisterCounter(fCounterID) ;
74  }
75 private:
76  PerformanceMetricID fCounterID;
77 };
78 
79 #endif // __PerformanceStats__
80