On Fri, 4 Aug 2023, Matthew Malcomson wrote: > Hopefully last update ... > > > Specifically, please try compiling with > > -ftime-report -fdiagnostics-format=sarif-file > > and have a look at the generated .sarif file, e.g. via > > python -m json.tool foo.c.sarif > > which will pretty-print the JSON to stdout. > > Rebasing onto the JSON output was quite simple -- I've inlined the only > change in the patch below (to cast to floating point seconds before > generating the json report). > > I have manually checked the SARIF output as you suggested and all looks > good (an in fact better because we no longer save some strange times > like the below due to avoiding the floating point rounding). > "wall": -4.49516e-09, > > > > > > The patch looks OK to me if it passes bootstrap / regtest and the > > output of -ftime-report doesn't change (too much). > > > > Thanks, > > Richard. > > Though I don't expect you were asking for this, confirmation below that > the output doesn't change. (Figured I may as well include that info > since the rebase to include the JSON output that David had just added > required re-sending an email anyway). > > > > ``` > hw-a20-8:checking-theory [10:07:01] $ ${old_build}/gcc/xgcc > -B${old_build}/gcc/ -fdiagnostics-plain-output -Os -w -S test-sum.c -o > /dev/null -ftime-report > > Time variable usr sys > wall GGC > phase setup : 0.01 ( 14%) 0.00 ( 0%) 0.02 ( > 18%) 3389k ( 74%) > phase parsing : 0.03 ( 43%) 0.02 ( 67%) 0.06 ( > 55%) 982k ( 21%) > phase opt and generate : 0.03 ( 43%) 0.01 ( 33%) 0.03 ( > 27%) 215k ( 5%) > callgraph functions expansion : 0.02 ( 29%) 0.00 ( 0%) 0.03 ( > 27%) 162k ( 4%) > callgraph ipa passes : 0.01 ( 14%) 0.01 ( 33%) -0.00 ( > -0%) 38k ( 1%) > CFG verifier : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 0 ( 0%) > preprocessing : 0.02 ( 29%) 0.02 ( 67%) 0.02 ( > 18%) 272k ( 6%) > lexical analysis : 0.01 ( 14%) 0.00 ( 0%) 0.02 ( > 18%) 0 ( 0%) > parser (global) : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 637k ( 14%) > parser function body : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 18k ( 0%) > tree CFG cleanup : 0.00 ( 0%) 0.01 ( 33%) 0.00 ( > 0%) 0 ( 0%) > tree STMT verifier : 0.01 ( 14%) 0.00 ( 0%) 0.00 ( > 0%) 0 ( 0%) > expand : 0.01 ( 14%) 0.00 ( 0%) 0.00 ( > 0%) 12k ( 0%) > loop init : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 12k ( 0%) > initialize rtl : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 15k ( 0%) > rest of compilation : 0.01 ( 14%) 0.00 ( 0%) 0.00 ( > 0%) 6920 ( 0%) > TOTAL : 0.07 0.03 0.11 > 4587k > Extra diagnostic checks enabled; compiler may run slowly. > Configure with --enable-checking=release to disable checks. > hw-a20-8:checking-theory [10:06:44] $ ${new_build}/gcc/xgcc > -B${new_build}/gcc/ -fdiagnostics-plain-output -Os -w -S test-sum.c -o > /dev/null -ftime-report > > Time variable usr sys > wall GGC > phase setup : 0.01 ( 17%) 0.00 ( 0%) 0.02 ( > 18%) 3389k ( 74%) > phase parsing : 0.02 ( 33%) 0.03 ( 75%) 0.05 ( > 45%) 982k ( 21%) > phase opt and generate : 0.03 ( 50%) 0.01 ( 25%) 0.04 ( > 36%) 215k ( 5%) > callgraph construction : 0.00 ( 0%) 0.01 ( 25%) 0.00 ( > 0%) 1864 ( 0%) > callgraph functions expansion : 0.02 ( 33%) 0.00 ( 0%) 0.03 ( > 27%) 162k ( 4%) > callgraph ipa passes : 0.01 ( 17%) 0.00 ( 0%) 0.01 ( > 9%) 38k ( 1%) > ipa free lang data : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 0 ( 0%) > CFG verifier : 0.02 ( 33%) 0.00 ( 0%) 0.00 ( > 0%) 0 ( 0%) > preprocessing : 0.01 ( 17%) 0.03 ( 75%) 0.01 ( > 9%) 272k ( 6%) > lexical analysis : 0.01 ( 17%) 0.00 ( 0%) 0.02 ( > 18%) 0 ( 0%) > parser (global) : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 637k ( 14%) > parser inl. func. body : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 19k ( 0%) > tree STMT verifier : 0.01 ( 17%) 0.00 ( 0%) 0.00 ( > 0%) 0 ( 0%) > expand : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 12k ( 0%) > integrated RA : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 50k ( 1%) > initialize rtl : 0.00 ( 0%) 0.00 ( 0%) 0.01 ( > 9%) 15k ( 0%) > TOTAL : 0.06 0.04 0.11 > 4587k > Extra diagnostic checks enabled; compiler may run slowly. > Configure with --enable-checking=release to disable checks. > ``` > > > N.b. in the change below it's worth mentioning that the > `nanosec_to_floating_sec` and `percent_of` macros were already defined. > I just moved them to below the `make_json_for_timevar_time_def` > function.
LGTM. Thanks for doing this, Richard. > ############### Changes to the previous patch. > ############### > > > @@ -832,12 +841,16 @@ json::object * > make_json_for_timevar_time_def (const timevar_time_def &ttd) > { > json::object *obj = new json::object (); > - obj->set ("user", new json::float_number (ttd.user)); > - obj->set ("sys", new json::float_number (ttd.sys)); > - obj->set ("wall", new json::float_number (ttd.wall)); > + obj->set ("user", > + new json::float_number (nanosec_to_floating_sec (ttd.user))); > + obj->set ("sys", new json::float_number (nanosec_to_floating_sec > (ttd.sys))); > + obj->set ("wall", > + new json::float_number (nanosec_to_floating_sec (ttd.wall))); > obj->set ("ggc_mem", new json::integer_number (ttd.ggc_mem)); > return obj; > } > +#undef nanosec_to_floating_sec > +#undef percent_of > > /* Create a json value representing this object, suitable for use > in SARIF output. */ > > > > -- Richard Biener <rguent...@suse.de> SUSE Software Solutions Germany GmbH, Frankenstrasse 146, 90461 Nuernberg, Germany; GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)