From ceb50cdf0ea50a0d48e53ad6ec13c458b117a784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ezgi=20=C3=87i=C3=A7ek?= Date: Tue, 18 Feb 2020 06:23:16 -0800 Subject: [PATCH] [cost] Adjust cold-start loom query Summary: In line with changes to loom query in D19903057, let's adjust Infer's processing of the results. Reviewed By: martintrojer Differential Revision: D19902933 fbshipit-source-id: 200b3a03e --- infer/src/atd/perf_profiler.atd | 8 +------- infer/src/backend/ExternalPerfData.ml | 14 +++---------- infer/src/unit/PerfProfilerATDParserTest.ml | 20 ++++--------------- .../loom_test.json | 2 +- 4 files changed, 9 insertions(+), 35 deletions(-) diff --git a/infer/src/atd/perf_profiler.atd b/infer/src/atd/perf_profiler.atd index 326d20dc2..6c7613989 100644 --- a/infer/src/atd/perf_profiler.atd +++ b/infer/src/atd/perf_profiler.atd @@ -7,17 +7,11 @@ type perf_profiler_item = { function_name: string; - count_trace_id: int; + approx_count_trace_id: int; sum_inclusive_cpu_time: float; avg_inclusive_cpu_time_ms: float; sum_exclusive_cpu_time: float; avg_exclusive_cpu_time_ms: float; - p90_inclusive_cpu_time_ms: float; - p90_exclusive_cpu_time_ms: float; - p50_inclusive_cpu_time_ms: float; - p50_exclusive_cpu_time_ms: float; - p25_inclusive_cpu_time_ms: float; - p25_exclusive_cpu_time_ms: float; } type perf_profiler = perf_profiler_item list diff --git a/infer/src/backend/ExternalPerfData.ml b/infer/src/backend/ExternalPerfData.ml index d5dc76ac3..514c3912a 100644 --- a/infer/src/backend/ExternalPerfData.ml +++ b/infer/src/backend/ExternalPerfData.ml @@ -45,17 +45,9 @@ let pp_perf_profiler_item itm = \ sum inclusive cpu time = %f@\n\ \ avg inclusive time = %f @\n\ \ sum exclusive cpu time = %f @\n\ - \ avg exclusive_time = %f @\n\ - \ inclusive p90 = %f @\n\ - \ exclusive p90 = %f @\n\ - \ inclusive p50 = %f @\n\ - \ exclusive p50 = %f @\n\ - \ inclusive p25 = %f @\n\ - \ exclusive p25 = %f @\n" - itm.function_name itm.count_trace_id itm.sum_inclusive_cpu_time itm.avg_inclusive_cpu_time_ms - itm.sum_exclusive_cpu_time itm.avg_exclusive_cpu_time_ms itm.p90_inclusive_cpu_time_ms - itm.p90_exclusive_cpu_time_ms itm.p50_inclusive_cpu_time_ms itm.p50_exclusive_cpu_time_ms - itm.p25_inclusive_cpu_time_ms itm.p25_exclusive_cpu_time_ms + \ avg exclusive_time = %f @\n" + itm.function_name itm.approx_count_trace_id itm.sum_inclusive_cpu_time + itm.avg_inclusive_cpu_time_ms itm.sum_exclusive_cpu_time itm.avg_exclusive_cpu_time_ms let _read_file_perf_data fname = diff --git a/infer/src/unit/PerfProfilerATDParserTest.ml b/infer/src/unit/PerfProfilerATDParserTest.ml index de68ff021..188d9bfa7 100644 --- a/infer/src/unit/PerfProfilerATDParserTest.ml +++ b/infer/src/unit/PerfProfilerATDParserTest.ml @@ -16,30 +16,18 @@ let test_parser = [ ("test_parser_1", "[]", []) ; ( "test_parser_2" , {|[{"function_name":"pkg/cls::\u003Cclinit>", - "count_trace_id": 2, + "approx_count_trace_id": 2, "sum_inclusive_cpu_time": 34.4324324, "avg_inclusive_cpu_time_ms":123.01234567899, "sum_exclusive_cpu_time": 17.4543543, - "avg_exclusive_cpu_time_ms":9.8765432123456, - "p90_inclusive_cpu_time_ms":1.0, - "p90_exclusive_cpu_time_ms":1.15, - "p50_inclusive_cpu_time_ms": 1.1, - "p50_exclusive_cpu_time_ms": 1.2, - "p25_inclusive_cpu_time_ms": 1.3, - "p25_exclusive_cpu_time_ms": 1.4 + "avg_exclusive_cpu_time_ms":9.8765432123456 }]|} , [ { Perf_profiler_t.function_name= "pkg/cls::" - ; count_trace_id= 2 + ; approx_count_trace_id= 2 ; sum_inclusive_cpu_time= 34.4324324 ; avg_inclusive_cpu_time_ms= 123.01234567899 ; sum_exclusive_cpu_time= 17.4543543 - ; avg_exclusive_cpu_time_ms= 9.8765432123456 - ; p90_inclusive_cpu_time_ms= 1.0 - ; p90_exclusive_cpu_time_ms= 1.15 - ; p50_inclusive_cpu_time_ms= 1.1 - ; p50_exclusive_cpu_time_ms= 1.2 - ; p25_inclusive_cpu_time_ms= 1.3 - ; p25_exclusive_cpu_time_ms= 1.4 } ] ) ] + ; avg_exclusive_cpu_time_ms= 9.8765432123456 } ] ) ] |> List.map ~f:(fun (name, test_input, expected_output) -> name >:: create_test test_input expected_output ) diff --git a/infer/tests/build_systems/differential_of_costs_report/loom_test.json b/infer/tests/build_systems/differential_of_costs_report/loom_test.json index 938a324e8..ce8e99d19 100644 --- a/infer/tests/build_systems/differential_of_costs_report/loom_test.json +++ b/infer/tests/build_systems/differential_of_costs_report/loom_test.json @@ -1 +1 @@ -[{"function_name":"DiffExampleColdStart::f1","count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0,"p90_inclusive_cpu_time_ms":22,"p90_exclusive_cpu_time_ms":0,"p50_inclusive_cpu_time_ms":22,"p50_exclusive_cpu_time_ms":0,"p25_inclusive_cpu_time_ms":22,"p25_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f2","count_trace_id":1,"sum_inclusive_cpu_time":11,"avg_inclusive_cpu_time_ms":11,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0,"p90_inclusive_cpu_time_ms":11,"p90_exclusive_cpu_time_ms":0,"p50_inclusive_cpu_time_ms":11,"p50_exclusive_cpu_time_ms":0,"p25_inclusive_cpu_time_ms":11,"p25_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f3","count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0,"p90_inclusive_cpu_time_ms":22,"p90_exclusive_cpu_time_ms":0,"p50_inclusive_cpu_time_ms":22,"p50_exclusive_cpu_time_ms":0,"p25_inclusive_cpu_time_ms":22,"p25_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f4","count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0,"p90_inclusive_cpu_time_ms":22,"p90_exclusive_cpu_time_ms":0,"p50_inclusive_cpu_time_ms":22,"p50_exclusive_cpu_time_ms":0,"p25_inclusive_cpu_time_ms":22,"p25_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f55","count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0,"p90_inclusive_cpu_time_ms":22,"p90_exclusive_cpu_time_ms":0,"p50_inclusive_cpu_time_ms":22,"p50_exclusive_cpu_time_ms":0,"p25_inclusive_cpu_time_ms":22,"p25_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f6","count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0,"p90_inclusive_cpu_time_ms":22,"p90_exclusive_cpu_time_ms":0,"p50_inclusive_cpu_time_ms":22,"p50_exclusive_cpu_time_ms":0,"p25_inclusive_cpu_time_ms":22,"p25_exclusive_cpu_time_ms":0}] +[{"function_name":"DiffExampleColdStart::f1","approx_count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f2","approx_count_trace_id":1,"sum_inclusive_cpu_time":11,"avg_inclusive_cpu_time_ms":11,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f3","approx_count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f4","approx_count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f55","approx_count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0},{"function_name":"DiffExampleColdStart::f6","approx_count_trace_id":2,"sum_inclusive_cpu_time":44,"avg_inclusive_cpu_time_ms":22,"sum_exclusive_cpu_time":0,"avg_exclusive_cpu_time_ms":0}]