MCPcopy Create free account
hub / github.com/apple/coremltools / __parse_java_result

Function __parse_java_result

deps/protobuf/benchmarks/util/result_parser.py:174–196  ·  view source on GitHub ↗
(filename)

Source from the content-addressed store, hash-verified

172# ...
173# ]
174def __parse_java_result(filename):
175 if filename == "":
176 return
177 if filename[0] != '/':
178 filename = os.path.dirname(os.path.abspath(__file__)) + '/' + filename
179 with open(filename, "rb") as f:
180 results = json.loads(f.read())
181 for result in results:
182 total_weight = 0
183 total_value = 0
184 for measurement in result["measurements"]:
185 total_weight += measurement["weight"]
186 total_value += measurement["value"]["magnitude"]
187 avg_time = total_value * 1.0 / total_weight
188 total_size, _ = __get_data_size(
189 result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"])
190 __results.append({
191 "language": "java",
192 "throughput": total_size / avg_time * 1e9 / 2 ** 20,
193 "behavior": result["scenario"]["benchmarkSpec"]["methodName"],
194 "dataFilename": __extract_file_name(
195 result["scenario"]["benchmarkSpec"]["parameters"]["dataFile"])
196 })
197
198
199# Go benchmark results:

Callers 1

get_result_from_fileFunction · 0.85

Calls 5

openFunction · 0.85
__get_data_sizeFunction · 0.85
__extract_file_nameFunction · 0.85
readMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected