@@ -75,6 +75,7 @@ TEST(RecordEvent, RecordEvent) {
75
75
* ...
76
76
* PopEvent(evt_name, dev_ctx);
77
77
*/
78
+ LOG (INFO) << " Usage 1: PushEvent & PopEvent" ;
78
79
for (int loop = 0 ; loop < 3 ; ++loop) {
79
80
for (int i = 1 ; i < 5 ; ++i) {
80
81
std::string name = " op_" + std::to_string (i);
@@ -93,13 +94,42 @@ TEST(RecordEvent, RecordEvent) {
93
94
* ...
94
95
* }
95
96
*/
97
+ LOG (INFO) << " Usage 2: RecordEvent" ;
96
98
for (int i = 1 ; i < 5 ; ++i) {
97
99
std::string name = " evs_op_" + std::to_string (i);
98
100
RecordEvent record_event (name, dev_ctx);
99
101
int counter = 1 ;
100
102
while (counter != i * 1000 ) counter++;
101
103
}
102
104
105
+ /* Usage 3
106
+ * {
107
+ * RecordEvent record_event(name1, dev_ctx);
108
+ * ...
109
+ * code to be analyzed
110
+ * ...
111
+ * {
112
+ * RecordEvent nested_record_event(name2, dev_ctx);
113
+ * ...
114
+ * code to be analyzed
115
+ * ...
116
+ * }
117
+ * }
118
+ */
119
+ LOG (INFO) << " Usage 3: nested RecordEvent" ;
120
+ for (int i = 1 ; i < 5 ; ++i) {
121
+ std::string name = " ano_evs_op_" + std::to_string (i);
122
+ RecordEvent record_event (name, dev_ctx);
123
+ int counter = 1 ;
124
+ while (counter != i * 100 ) counter++;
125
+ {
126
+ std::string nested_name = " nested_ano_evs_op_" + std::to_string (i);
127
+ RecordEvent nested_record_event (nested_name, dev_ctx);
128
+ int nested_counter = 1 ;
129
+ while (nested_counter != i * 100 ) nested_counter++;
130
+ }
131
+ }
132
+
103
133
// Bad Usage:
104
134
PushEvent (" event_without_pop" , dev_ctx);
105
135
PopEvent (" event_without_push" , dev_ctx);
0 commit comments