InDesign SDK  20.5
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
RealTimeMark.h
1 //========================================================================================
2 //
3 // $File$
4 //
5 // Owner: Steve Flenniken
6 //
7 // $Author$
8 //
9 // $DateTime$
10 //
11 // $Revision$
12 //
13 // $Change$
14 //
15 // Copyright 1997-2010 Adobe Systems Incorporated. All rights reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance
18 // with the terms of the Adobe license agreement accompanying it. If you have received
19 // this file from a source other than Adobe, then your use, modification, or
20 // distribution of it requires the prior written permission of Adobe.
21 //
22 //========================================================================================
23 
24 #ifndef __REALTIMEMARK__
25 #define __REALTIMEMARK__
26 
27 #include "stdio.h"
28 
29 #ifdef WASM
30 #include <boost/chrono.hpp>
31 #endif
32 
33 #ifndef REALTIMEMARKS
34  #ifdef BENCHMARK_ONLY
35  #define REALTIMEMARKS BENCHMARK_ONLY
36 #endif
37 #endif
38 
39 #ifdef REALTIMEMARKS
40 class RUNTIME_DECL RealTimeMark
41 {
42 public:
43  static void Initialize();
44  static void DisplayTime(const char *string);
45  static void Shutdown();
46 
47 private:
48 #if WINDOWS
49  static double ts_gRtmFrequency;
50  static uint64 ts_gRtmStartTime;
51 
52  static FILE *ts_gRtmFile;
53 #elif MACINTOSH
54  static double ts_gRtmMultiplier;
55  static uint64 ts_gRtmStartTime;
56 
57  static int ts_gRtmFileDes; //file Descriptor
58 #elif WASM
59 
60  typedef boost::chrono::steady_clock::time_point chrono_time_point;
61  typedef boost::chrono::milliseconds duration_millisec;
62 
63  static double ts_gRtmMultiplier;
64  static chrono_time_point ts_gRtmStartTime;
65  static chrono_time_point tl_RtmLastTime;
66 
67  static FILE* ts_gRtmFileDes;
68 #endif
69 };
70 #define RealTimeMarkInitialize() RealTimeMark::Initialize()
71 
72 // Add this line to your code, when it executes the current
73 // time is written to the file RealTimeMark.csv which is
74 // in same folder as the exe.
75 #define RealTimeMark(string) RealTimeMark::DisplayTime(string)
76 
77 #define RealTimeMarkShutdown() RealTimeMark::Shutdown()
78 #else
79 // when we turn benchmarks off, RealTimeMark will get turned off as well
80 #define RealTimeMarkInitialize()
81 #define RealTimeMark(string)
82 #define RealTimeMarkShutdown()
83 
84 #endif
85 #endif