@@ -618,38 +618,32 @@ void final_serialize_heap_snapshot(ios_t *json, ios_t *strings, HeapSnapshot &sn
618618{
619619 // mimicking https://github.com/nodejs/node/blob/5fd7a72e1c4fbaf37d3723c4c81dce35c149dc84/deps/v8/src/profiler/heap-snapshot-generator.cc#L2567-L2567
620620 // also https://github.com/microsoft/vscode-v8-heap-tools/blob/c5b34396392397925ecbb4ecb904a27a2754f2c1/v8-heap-parser/src/decoder.rs#L43-L51
621- ios_printf (json, " {\" snapshot\" :{" );
621+ ios_printf (json, " {\" snapshot\" :{\n " );
622622
623- ios_printf (json, " \" meta\" :{" );
624- ios_printf (json, " \" node_fields\" :[\" type\" ,\" name\" ,\" id\" ,\" self_size\" ,\" edge_count\" ,\" trace_node_id\" ,\" detachedness\" ]," );
625- ios_printf (json, " \" node_types\" :[" );
623+ ios_printf (json, " \" meta\" :{\n " );
624+ ios_printf (json, " \" node_fields\" :[\" type\" ,\" name\" ,\" id\" ,\" self_size\" ,\" edge_count\" ,\" trace_node_id\" ,\" detachedness\" ],\n " );
625+ ios_printf (json, " \" node_types\" :[" );
626626 snapshot.node_types .print_json_array (json, false );
627627 ios_printf (json, " ," );
628- ios_printf (json, " \" string\" , \" number\" , \" number\" , \" number\" , \" number\" , \" number\" ]," );
629- ios_printf (json, " \" edge_fields\" :[\" type\" ,\" name_or_index\" ,\" to_node\" ]," );
630- ios_printf (json, " \" edge_types\" :[" );
628+ ios_printf (json, " \" string\" , \" number\" , \" number\" , \" number\" , \" number\" , \" number\" ],\n " );
629+ ios_printf (json, " \" edge_fields\" :[\" type\" ,\" name_or_index\" ,\" to_node\" ],\n " );
630+ ios_printf (json, " \" edge_types\" :[" );
631631 snapshot.edge_types .print_json_array (json, false );
632632 ios_printf (json, " ," );
633- ios_printf (json, " \" string_or_number\" ,\" from_node\" ]," );
633+ ios_printf (json, " \" string_or_number\" ,\" from_node\" ],\n " );
634634 // not used. Required by microsoft/vscode-v8-heap-tools
635- ios_printf (json, " \" trace_function_info_fields\" :[\" function_id\" ,\" name\" ,\" script_name\" ,\" script_id\" ,\" line\" ,\" column\" ]," );
636- ios_printf (json, " \" trace_node_fields\" :[\" id\" ,\" function_info_index\" ,\" count\" ,\" size\" ,\" children\" ]," );
637- ios_printf (json, " \" sample_fields\" :[\" timestamp_us\" ,\" last_assigned_id\" ]," );
638- ios_printf (json, " \" location_fields\" :[\" object_index\" ,\" script_id\" ,\" line\" ,\" column\" ]" );
635+ ios_printf (json, " \" trace_function_info_fields\" :[\" function_id\" ,\" name\" ,\" script_name\" ,\" script_id\" ,\" line\" ,\" column\" ],\n " );
636+ ios_printf (json, " \" trace_node_fields\" :[\" id\" ,\" function_info_index\" ,\" count\" ,\" size\" ,\" children\" ],\n " );
637+ ios_printf (json, " \" sample_fields\" :[\" timestamp_us\" ,\" last_assigned_id\" ],\n " );
638+ ios_printf (json, " \" location_fields\" :[\" object_index\" ,\" script_id\" ,\" line\" ,\" column\" ]\n " );
639639 // end not used
640- ios_printf (json, " },\n " ); // end "meta"
640+ ios_printf (json, " },\n " ); // end "meta"
641641
642- ios_printf (json, " \" node_count\" :%zu," , snapshot.num_nodes );
643- ios_printf (json, " \" edge_count\" :%zu," , snapshot.num_edges );
644- ios_printf (json, " \" trace_function_count\" :0" ); // not used. Required by microsoft/vscode-v8-heap-tools
645- ios_printf (json, " },\n " ); // end "snapshot"
646-
647- // not used. Required by microsoft/vscode-v8-heap-tools
648- ios_printf (json, " \" trace_function_infos\" :[]," );
649- ios_printf (json, " \" trace_tree\" :[]," );
650- ios_printf (json, " \" samples\" :[]," );
651- ios_printf (json, " \" locations\" :[]" );
652- // end not used
642+ ios_printf (json, " \" node_count\" :%zu,\n " , snapshot.num_nodes );
643+ ios_printf (json, " \" edge_count\" :%zu,\n " , snapshot.num_edges );
644+ ios_printf (json, " \" trace_function_count\" :0\n " ); // not used. Required by microsoft/vscode-v8-heap-tools
645+ ios_printf (json, " }\n " ); // end "snapshot"
653646
647+ // this } is removed by the julia reassembler in Profile
654648 ios_printf (json, " }" );
655649}
0 commit comments