@@ -15,10 +15,8 @@ cali_id_t cali_class_memoryaddress_attr_id = CALI_INV_ID;
15
15
cali_id_t cali_class_iteration_attr_id = CALI_INV_ID;
16
16
cali_id_t cali_subscription_event_attr_id = CALI_INV_ID;
17
17
18
- cali_id_t cali_function_attr_id = CALI_INV_ID;
19
- cali_id_t cali_loop_attr_id = CALI_INV_ID;
20
- cali_id_t cali_statement_attr_id = CALI_INV_ID;
21
- cali_id_t cali_annotation_attr_id = CALI_INV_ID;
18
+ cali_id_t cali_loop_attr_id = CALI_INV_ID;
19
+ cali_id_t cali_region_attr_id = CALI_INV_ID;
22
20
23
21
cali_id_t cali_alloc_fn_attr_id = CALI_INV_ID;
24
22
cali_id_t cali_alloc_label_attr_id = CALI_INV_ID;
@@ -36,75 +34,35 @@ namespace cali
36
34
Attribute class_memoryaddress_attr;
37
35
Attribute class_iteration_attr;
38
36
Attribute subscription_event_attr;
39
-
40
- Attribute function_attr ;
37
+
38
+ Attribute region_attr ;
41
39
Attribute loop_attr;
42
- Attribute statement_attr;
43
- Attribute annotation_attr;
44
40
45
41
void init_attribute_classes (Caliper* c) {
46
- struct attr_info_t {
47
- const char * name;
48
- cali_attr_type type;
49
- int prop;
50
- Attribute* attr;
51
- cali_id_t * attr_id;
52
- } attr_info[] = {
53
- { " class.aggregatable" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS,
54
- &class_aggregatable_attr, &cali_class_aggregatable_attr_id
55
- },
56
- { " class.symboladdress" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS,
57
- &class_symboladdress_attr, &cali_class_symboladdress_attr_id
58
- },
59
- { " class.memoryaddress" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS,
60
- &class_memoryaddress_attr, &cali_class_memoryaddress_attr_id
61
- },
62
- { " class.iteration" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS,
63
- &class_iteration_attr, &cali_class_iteration_attr_id
64
- },
65
- { " subscription_event" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS,
66
- &subscription_event_attr, &cali_subscription_event_attr_id
67
- },
68
- { 0 , CALI_TYPE_INV, CALI_ATTR_DEFAULT, 0 , 0 }
69
- };
42
+ class_aggregatable_attr =
43
+ c->create_attribute (" class.aggregatable" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS);
44
+ class_symboladdress_attr =
45
+ c->create_attribute (" class.symboladdress" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS);
46
+ class_memoryaddress_attr =
47
+ c->create_attribute (" class.memoryaddress" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS);
48
+ class_iteration_attr =
49
+ c->create_attribute (" class.iteration" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS);
50
+ subscription_event_attr =
51
+ c->create_attribute (" subscription_event" , CALI_TYPE_BOOL, CALI_ATTR_SKIP_EVENTS);
70
52
71
- for (attr_info_t *p = attr_info; p->name ; ++p) {
72
- *(p->attr ) =
73
- c->create_attribute (p->name , p->type , p->prop );
74
- *(p->attr_id ) = (p->attr )->id ();
75
- }
53
+ cali_class_aggregatable_attr_id = class_aggregatable_attr.id ();
54
+ cali_class_symboladdress_attr_id = class_symboladdress_attr.id ();
55
+ cali_class_memoryaddress_attr_id = class_memoryaddress_attr.id ();
56
+ cali_class_iteration_attr_id = class_iteration_attr.id ();
76
57
}
77
58
78
59
void init_api_attributes (Caliper* c) {
79
- // --- code annotation attributes
80
-
81
- struct attr_info_t {
82
- const char * name;
83
- cali_attr_type type;
84
- int prop;
85
- Attribute* attr;
86
- cali_id_t * attr_id;
87
- } attr_info[] = {
88
- { " function" , CALI_TYPE_STRING, CALI_ATTR_NESTED,
89
- &function_attr, &cali_function_attr_id
90
- },
91
- { " loop" , CALI_TYPE_STRING, CALI_ATTR_NESTED,
92
- &loop_attr, &cali_loop_attr_id
93
- },
94
- { " statement" , CALI_TYPE_STRING, CALI_ATTR_NESTED,
95
- &statement_attr, &cali_statement_attr_id
96
- },
97
- { " annotation" , CALI_TYPE_STRING, CALI_ATTR_NESTED,
98
- &annotation_attr, &cali_annotation_attr_id
99
- },
100
- { 0 , CALI_TYPE_INV, CALI_ATTR_DEFAULT, 0 , 0 }
101
- };
60
+ loop_attr =
61
+ c->create_attribute (" loop" , CALI_TYPE_STRING, CALI_ATTR_NESTED);
62
+ region_attr =
63
+ c->create_attribute (" region" , CALI_TYPE_STRING, CALI_ATTR_NESTED);
102
64
103
- Variant v_true (true );
104
-
105
- for (attr_info_t *p = attr_info; p->name ; ++p) {
106
- *(p->attr ) = c->create_attribute (p->name , p->type , p->prop );
107
- *(p->attr_id ) = (p->attr )->id ();
108
- }
65
+ cali_region_attr_id = region_attr.id ();
66
+ cali_loop_attr_id = loop_attr.id ();
109
67
}
110
68
}
0 commit comments