@@ -37,46 +37,29 @@ int main(void) {
37
37
ddog_prof_ValueType vt = {.type_id = vt_type , .unit_id = vt_unit };
38
38
39
39
// Insert function/mapping strings and create ids
40
- ddog_prof_StringId fn_name = {0 }, fn_sys = { 0 }, fn_file = { 0 };
41
- check_ok (ddog_prof_ProfilesDictionary_insert_str (& fn_name , dict , DDOG_CHARSLICE_C ("{main}" ),
40
+ ddog_prof_Function func = {. system_name = DDOG_PROF_STRINGID_EMPTY };
41
+ check_ok (ddog_prof_ProfilesDictionary_insert_str (& func . name , dict , DDOG_CHARSLICE_C ("{main}" ),
42
42
DDOG_PROF_UTF8_OPTION_VALIDATE ),
43
43
"insert_str(fn name)" );
44
- check_ok (ddog_prof_ProfilesDictionary_insert_str (& fn_sys , dict , DDOG_CHARSLICE_C ("{main}" ),
45
- DDOG_PROF_UTF8_OPTION_VALIDATE ),
46
- "insert_str(fn system)" );
47
- check_ok (ddog_prof_ProfilesDictionary_insert_str (& fn_file , dict ,
44
+ check_ok (ddog_prof_ProfilesDictionary_insert_str (& func .file_name , dict ,
48
45
DDOG_CHARSLICE_C ("/srv/example/index.php" ),
49
46
DDOG_PROF_UTF8_OPTION_VALIDATE ),
50
47
"insert_str(fn file)" );
51
48
52
- ddog_prof_Function func = {.name = fn_name , .system_name = fn_sys , .file_name = fn_file };
53
49
ddog_prof_FunctionId func_id = NULL ;
54
50
check_ok (ddog_prof_ProfilesDictionary_insert_function (& func_id , dict , & func ), "insert_function" );
55
51
56
- ddog_prof_StringId map_file = {0 }, map_build = {0 };
57
- check_ok (ddog_prof_ProfilesDictionary_insert_str (
58
- & map_file , dict , DDOG_CHARSLICE_C ("/bin/example" ), DDOG_PROF_UTF8_OPTION_VALIDATE ),
59
- "insert_str(map filename)" );
60
- check_ok (ddog_prof_ProfilesDictionary_insert_str (& map_build , dict , DDOG_CHARSLICE_C ("deadbeef" ),
52
+ ddog_prof_Mapping mapping = {.build_id = DDOG_PROF_STRINGID_EMPTY };
53
+ check_ok (ddog_prof_ProfilesDictionary_insert_str (& mapping .filename , dict ,
54
+ DDOG_CHARSLICE_C ("/bin/example" ),
61
55
DDOG_PROF_UTF8_OPTION_VALIDATE ),
62
- "insert_str(map build)" );
63
- ddog_prof_Mapping mapping = {
64
- .memory_start = 0 ,
65
- .memory_limit = 0 ,
66
- .file_offset = 0 ,
67
- .filename = map_file ,
68
- .build_id = map_build ,
69
- };
56
+ "insert_str(map filename)" );
70
57
ddog_prof_MappingId map_id = NULL ;
71
58
check_ok (ddog_prof_ProfilesDictionary_insert_mapping (& map_id , dict , & mapping ), "insert_mapping" );
72
59
73
60
// Create a location in the scratchpad
74
- ddog_prof_Option_FunctionId opt_fn = {.tag = DDOG_PROF_OPTION_FUNCTION_ID_SOME_FUNCTION_ID ,
75
- .some = func_id };
76
- ddog_prof_Option_MappingId opt_map = {.tag = DDOG_PROF_OPTION_MAPPING_ID_SOME_MAPPING_ID ,
77
- .some = map_id };
78
- ddog_prof_Line line = {.line_number = 0 , .function_id = opt_fn };
79
- ddog_prof_Location loc = {.address = 0 , .mapping_id = opt_map , .line = line };
61
+ ddog_prof_Line line = {.line_number = 0 , .function_id = func_id };
62
+ ddog_prof_Location loc = {.address = 0 , .mapping_id = map_id , .line = line };
80
63
ddog_prof_LocationId loc_id = NULL ;
81
64
check_ok (ddog_prof_ScratchPad_insert_location (& loc_id , scratch , & loc ),
82
65
"ScratchPad_insert_location" );
0 commit comments