Gocator Development Kit
Home
Topics
Types
Files
All
Classes
Files
Functions
Variables
Typedefs
Friends
Modules
Pages
GdkTimeStampCollector.h
1
/*
2
* This class is used to collect one or more time stamps during an iteration,
3
* and to collect the iterations together.
4
*
5
* An iteration encompasses a set of actions that take place based on some trigger.
6
* The same set of actions are expected to take place when the next trigger occurs.
7
*
8
* One use is to collect time stamps in a processing path for some input data.
9
* Each pass through the processing path is an iteration. Within an iteration of the processing
10
* path, it may be useful to know the duration of each step in the path takes. The
11
* duration can be calculated by taking the difference between collector collected
12
* before and after the step.
13
*
14
* The output is a text file stored in /user directory.
15
* Each line contains one iteration's timestamps in the following format
16
* (where "ts" means "timestamp").
17
*
18
* <iteration#>,<ts1>,<ts2>,...,<tsn>
19
*
20
* The file can be imported into a spreadsheet program to calculate time deltas.
21
*
22
* !!!! WARNING !!!!
23
* This class MUST NEVER be used in production code because the time stamp
24
* collection slows down product performance.
25
*
26
* EXAMPLE USAGE:
27
* - example is based on using the GtDimensionTool.c.
28
*
29
* 1. Create the collector
30
*
31
* GtFx(kStatus) GtDimensionTool_VInit(GtDimensionTool info, kType type, kAlloc alloc)
32
* {
33
* ....
34
* // Create the collector to collect 2 timestamps.
35
* GdkTimeStampCollector_Construct(&obj->collector, 2, alloc);
36
* ....
37
* }
38
*
39
* 2. Clear the timestamp list in preparation for collecting timestamps.
40
*
41
* GtFx(kStatus) GtDimensionTool_VStart(GtDimensionTool tool)
42
* {
43
* ....
44
* GdkTimeStampCollector_Start(obj->collector);
45
* ....
46
* }
47
*
48
* 3. Mark the start, collect two timestamp and then mark the stop of an iteration
49
* to save the collected timestamps.
50
*
51
* GtFx(kStatus) GtDimensionTool_VProcess(GtDimensionTool tool, GdkToolInput input, GdkToolOutput output)
52
* {
53
* ....
54
* GdkTimeStampCollector_StartIteration(obj->collector);
55
* ....
56
* GdkTimeStampCollector_AddTimeStamp(obj->collector, 0);
57
* ....
58
* GdkTimeStampCollector_AddTimeStamp(obj->collector, 1);
59
* ....
60
* GdkTimeStampCollector_EndIteration(obj->collector);
61
* ....
62
* }
63
*
64
* 4. Stop collecting timestamps and output to a file.
65
*
66
* GtFx(kStatus) GtDimensionTool_VStop(GtDimensionTool tool)
67
* {
68
* ....
69
* GdkTimeStampCollector_Stop(obj->collector);
70
* ....
71
* }
72
*
73
* 5. Free the collector object
74
*
75
* GtFx(kStatus) GtDimensionTool_VRelease(GtDimensionTool info)
76
* {
77
* ....
78
* kDestroyRef(&obj->collector);
79
* ....
80
* }
81
*
82
*/
83
#ifndef GDK_TIMESTAMP_COLLECTOR_H
84
#define GDK_TIMESTAMP_COLLECTOR_H
85
86
#include <
Gdk/GdkDef.h
>
87
88
typedef
kObject
GdkTimeStampCollector
;
89
kDeclareClassEx
(
Gdk
,
GdkTimeStampCollector
,
kObject
)
90
91
GdkFx(
kStatus
) GdkTimeStampCollector_Construct(
GdkTimeStampCollector
* collector,
k32u
numStamps,
kAlloc
alloc);
92
93
GdkFx(
k32s
) GdkTimeStampCollector_Start(
GdkTimeStampCollector
collector);
94
GdkFx(
kStatus
) GdkTimeStampCollector_Stop(
GdkTimeStampCollector
collector);
95
GdkFx(
k32s
) GdkTimeStampCollector_StartIteration(
GdkTimeStampCollector
collector);
96
GdkFx(
k32s
) GdkTimeStampCollector_EndIteration(
GdkTimeStampCollector
collector);
97
GdkFx(
kStatus
) GdkTimeStampCollector_AddTimeStamp(
GdkTimeStampCollector
collector,
kSize
entryNum);
98
99
#endif // GDK_TIMESTAMP_COLLECTOR_H
GdkDef.h
Essential Gdk declarations.
k32u
Gdk
Definition:
GdkCfgInterfaces.h:14
kSize
kAlloc
kDeclareClassEx
#define kDeclareClassEx(PREFIX, SYMBOL, BASE)
k32s
kObject
kStatus
Utils
GdkTimeStampCollector.h