@@ -607,38 +607,32 @@ void final_serialize_heap_snapshot(ios_t *json, ios_t *strings, HeapSnapshot &sn
607
607
{
608
608
// mimicking https://github.com/nodejs/node/blob/5fd7a72e1c4fbaf37d3723c4c81dce35c149dc84/deps/v8/src/profiler/heap-snapshot-generator.cc#L2567-L2567
609
609
// also https://github.com/microsoft/vscode-v8-heap-tools/blob/c5b34396392397925ecbb4ecb904a27a2754f2c1/v8-heap-parser/src/decoder.rs#L43-L51
610
- ios_printf (json, " {\" snapshot\" :{" );
610
+ ios_printf (json, " {\" snapshot\" :{\n " );
611
611
612
- ios_printf (json, " \" meta\" :{" );
613
- ios_printf (json, " \" node_fields\" :[\" type\" ,\" name\" ,\" id\" ,\" self_size\" ,\" edge_count\" ,\" trace_node_id\" ,\" detachedness\" ]," );
614
- ios_printf (json, " \" node_types\" :[" );
612
+ ios_printf (json, " \" meta\" :{\n " );
613
+ ios_printf (json, " \" node_fields\" :[\" type\" ,\" name\" ,\" id\" ,\" self_size\" ,\" edge_count\" ,\" trace_node_id\" ,\" detachedness\" ],\n " );
614
+ ios_printf (json, " \" node_types\" :[" );
615
615
snapshot.node_types .print_json_array (json, false );
616
616
ios_printf (json, " ," );
617
- ios_printf (json, " \" string\" , \" number\" , \" number\" , \" number\" , \" number\" , \" number\" ]," );
618
- ios_printf (json, " \" edge_fields\" :[\" type\" ,\" name_or_index\" ,\" to_node\" ]," );
619
- ios_printf (json, " \" edge_types\" :[" );
617
+ ios_printf (json, " \" string\" , \" number\" , \" number\" , \" number\" , \" number\" , \" number\" ],\n " );
618
+ ios_printf (json, " \" edge_fields\" :[\" type\" ,\" name_or_index\" ,\" to_node\" ],\n " );
619
+ ios_printf (json, " \" edge_types\" :[" );
620
620
snapshot.edge_types .print_json_array (json, false );
621
621
ios_printf (json, " ," );
622
- ios_printf (json, " \" string_or_number\" ,\" from_node\" ]," );
622
+ ios_printf (json, " \" string_or_number\" ,\" from_node\" ],\n " );
623
623
// not used. Required by microsoft/vscode-v8-heap-tools
624
- ios_printf (json, " \" trace_function_info_fields\" :[\" function_id\" ,\" name\" ,\" script_name\" ,\" script_id\" ,\" line\" ,\" column\" ]," );
625
- ios_printf (json, " \" trace_node_fields\" :[\" id\" ,\" function_info_index\" ,\" count\" ,\" size\" ,\" children\" ]," );
626
- ios_printf (json, " \" sample_fields\" :[\" timestamp_us\" ,\" last_assigned_id\" ]," );
627
- ios_printf (json, " \" location_fields\" :[\" object_index\" ,\" script_id\" ,\" line\" ,\" column\" ]" );
624
+ ios_printf (json, " \" trace_function_info_fields\" :[\" function_id\" ,\" name\" ,\" script_name\" ,\" script_id\" ,\" line\" ,\" column\" ],\n " );
625
+ ios_printf (json, " \" trace_node_fields\" :[\" id\" ,\" function_info_index\" ,\" count\" ,\" size\" ,\" children\" ],\n " );
626
+ ios_printf (json, " \" sample_fields\" :[\" timestamp_us\" ,\" last_assigned_id\" ],\n " );
627
+ ios_printf (json, " \" location_fields\" :[\" object_index\" ,\" script_id\" ,\" line\" ,\" column\" ]\n " );
628
628
// end not used
629
- ios_printf (json, " },\n " ); // end "meta"
629
+ ios_printf (json, " },\n " ); // end "meta"
630
630
631
- ios_printf (json, " \" node_count\" :%zu," , snapshot.num_nodes );
632
- ios_printf (json, " \" edge_count\" :%zu," , snapshot.num_edges );
633
- ios_printf (json, " \" trace_function_count\" :0" ); // not used. Required by microsoft/vscode-v8-heap-tools
634
- ios_printf (json, " },\n " ); // end "snapshot"
635
-
636
- // not used. Required by microsoft/vscode-v8-heap-tools
637
- ios_printf (json, " \" trace_function_infos\" :[]," );
638
- ios_printf (json, " \" trace_tree\" :[]," );
639
- ios_printf (json, " \" samples\" :[]," );
640
- ios_printf (json, " \" locations\" :[]" );
641
- // end not used
631
+ ios_printf (json, " \" node_count\" :%zu,\n " , snapshot.num_nodes );
632
+ ios_printf (json, " \" edge_count\" :%zu,\n " , snapshot.num_edges );
633
+ ios_printf (json, " \" trace_function_count\" :0\n " ); // not used. Required by microsoft/vscode-v8-heap-tools
634
+ ios_printf (json, " }\n " ); // end "snapshot"
642
635
636
+ // this } is removed by the julia reassembler in Profile
643
637
ios_printf (json, " }" );
644
638
}
0 commit comments