@@ -24,11 +24,11 @@ def test_basic_trace(self):
24
24
self .assertTrue (len (snapshots ) > 10 )
25
25
26
26
self .assertTrue (cat .has_snapshot_with_keys (
27
- snapshots , {'iteration' , 'phase ' , 'time.inclusive.duration.ns' }))
27
+ snapshots , {'iteration' , 'myphase ' , 'time.inclusive.duration.ns' }))
28
28
self .assertTrue (cat .has_snapshot_with_attributes (
29
- snapshots , {'event.end#phase ' : 'initialization' , 'phase ' : 'initialization' }))
29
+ snapshots , {'event.end#myphase ' : 'initialization' , 'myphase ' : 'initialization' }))
30
30
self .assertTrue (cat .has_snapshot_with_attributes (
31
- snapshots , {'event.end#iteration' : '3' , 'iteration' : '3' , 'phase ' : 'loop' }))
31
+ snapshots , {'event.end#iteration' : '3' , 'iteration' : '3' , 'myphase ' : 'loop' }))
32
32
33
33
def test_cali_config (self ):
34
34
# Test the builtin ConfigManager (CALI_CONFIG env var)
@@ -47,11 +47,11 @@ def test_cali_config(self):
47
47
self .assertTrue (len (snapshots ) > 10 )
48
48
49
49
self .assertTrue (cat .has_snapshot_with_keys (
50
- snapshots , {'iteration' , 'phase ' , 'time.inclusive.duration.ns' }))
50
+ snapshots , {'iteration' , 'myphase ' , 'time.inclusive.duration.ns' }))
51
51
self .assertTrue (cat .has_snapshot_with_attributes (
52
- snapshots , {'event.end#phase ' : 'initialization' , 'phase ' : 'initialization' }))
52
+ snapshots , {'event.end#myphase ' : 'initialization' , 'myphase ' : 'initialization' }))
53
53
self .assertTrue (cat .has_snapshot_with_attributes (
54
- snapshots , {'event.end#iteration' : '3' , 'iteration' : '3' , 'phase ' : 'loop' }))
54
+ snapshots , {'event.end#iteration' : '3' , 'iteration' : '3' , 'myphase ' : 'loop' }))
55
55
56
56
def test_ann_metadata (self ):
57
57
target_cmd = [ './ci_test_basic' ]
@@ -67,7 +67,7 @@ def test_ann_metadata(self):
67
67
snapshots = cat .get_snapshots_from_text (query_output )
68
68
69
69
self .assertTrue (cat .has_snapshot_with_attributes (
70
- snapshots , { 'cali.attribute.name' : 'phase ' ,
70
+ snapshots , { 'cali.attribute.name' : 'myphase ' ,
71
71
'meta.int' : '42' ,
72
72
'cali.attribute.prop' : '20' # default property: CALI_ATTR_SCOPE_THREAD
73
73
}))
@@ -87,7 +87,7 @@ def test_default_scope_switch(self):
87
87
snapshots = cat .get_snapshots_from_text (query_output )
88
88
89
89
self .assertTrue (cat .has_snapshot_with_attributes (
90
- snapshots , { 'cali.attribute.name' : 'phase ' ,
90
+ snapshots , { 'cali.attribute.name' : 'myphase ' ,
91
91
'meta.int' : '42' ,
92
92
'cali.attribute.prop' : '12' # CALI_ATTR_SCOPE_PROCESS
93
93
}))
@@ -280,5 +280,25 @@ def test_exclusive_region_filter(self):
280
280
snapshots , {
281
281
'region' : 'main/before_loop' }))
282
282
283
+ def test_region_level_filter (self ):
284
+ target_cmd = [ './ci_test_macros' , '0' , 'hatchet-region-profile,level=phase,output=stdout' ]
285
+ query_cmd = [ '../../src/tools/cali-query/cali-query' , '-e' ]
286
+
287
+ query_output = cat .run_test_with_query (target_cmd , query_cmd , None )
288
+ snapshots = cat .get_snapshots_from_text (query_output )
289
+
290
+ self .assertFalse (cat .has_snapshot_with_attributes (
291
+ snapshots , {
292
+ 'region' : 'main/foo' ,
293
+ 'loop' : 'main loop/fooloop' }))
294
+ self .assertFalse (cat .has_snapshot_with_attributes (
295
+ snapshots , {
296
+ 'region' : 'main/bar' ,
297
+ 'phase' : 'after_loop' }))
298
+ self .assertTrue (cat .has_snapshot_with_attributes (
299
+ snapshots , {
300
+ 'region' : 'main' ,
301
+ 'phase' : 'after_loop' }))
302
+
283
303
if __name__ == "__main__" :
284
304
unittest .main ()
0 commit comments