Adding a new ATD-based parser for JSON data containing profiler results

Reviewed By: ezgicicek

Differential Revision: D8447384

fbshipit-source-id: 7b890e8
master
Martino Luca 7 years ago committed by Facebook Github Bot
parent a274cdf785
commit 8b7148d5b0

@ -19,7 +19,7 @@ INFER_MAIN = infer
#### Checkers declarations #### #### Checkers declarations ####
INFER_ATDGEN_STUB_BASES = atd/jsonbug atd/runstate atd/stacktree atd/java_method_decl INFER_ATDGEN_STUB_BASES = atd/jsonbug atd/runstate atd/stacktree atd/java_method_decl atd/perf_profiler
INFER_ATDGEN_TYPES = j t INFER_ATDGEN_TYPES = j t
INFER_ATDGEN_STUB_ATDS = $(INFER_ATDGEN_STUB_BASES:.atd) INFER_ATDGEN_STUB_ATDS = $(INFER_ATDGEN_STUB_BASES:.atd)
INFER_ATDGEN_SUFFIXES = $(foreach atd_t,$(INFER_ATDGEN_TYPES),_$(atd_t).ml _$(atd_t).mli) INFER_ATDGEN_SUFFIXES = $(foreach atd_t,$(INFER_ATDGEN_TYPES),_$(atd_t).ml _$(atd_t).mli)

@ -0,0 +1,7 @@
type perf_profiler_item = {
function_name : string;
avg_inclusive_cpu_time_ms : float;
avg_exclusive_cpu_time_ms : float;
}
type perf_profiler = perf_profiler_item list

@ -0,0 +1,26 @@
(*
* Copyright (c) 2018-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*)
open! IStd
open OUnit2
let test_parser =
let create_test input expected _ =
let found = Perf_profiler_j.perf_profiler_of_string input in
assert_equal expected found
in
[ ("test_parser_1", "[]", [])
; ( "test_parser_2"
, {|[{"function_name":"pkg/cls::\u003Cclinit>","avg_inclusive_cpu_time_ms":123.01234567899,"avg_exclusive_cpu_time_ms":9.8765432123456}]|}
, [ { Perf_profiler_t.function_name= "pkg/cls::<clinit>"
; avg_inclusive_cpu_time_ms= 123.01234567899
; avg_exclusive_cpu_time_ms= 9.8765432123456 } ] ) ]
|> List.map ~f:(fun (name, test_input, expected_output) ->
name >:: create_test test_input expected_output )
let tests = "java_profiler_samples" >::: test_parser

@ -35,6 +35,7 @@ let () =
; DifferentialFiltersTests.tests ; DifferentialFiltersTests.tests
; FileDiffTests.tests ; FileDiffTests.tests
; JavaProfilerSamplesTest.tests ; JavaProfilerSamplesTest.tests
; PerfProfilerATDParserTest.tests
; ProcCfgTests.tests ; ProcCfgTests.tests
; LivenessTests.tests ; LivenessTests.tests
; SchedulerTests.tests ; SchedulerTests.tests

Loading…
Cancel
Save