forked from matlab-deep-learning/mtcnn-face-detection
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathperfresults2pybenchjson.m
79 lines (59 loc) · 1.74 KB
/
perfresults2pybenchjson.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
function json = perfresults2pybenchjson(results)
machine_info.node = matlab.unittest.internal.getHostname;
commit_info.id = "unversioned";
commit_info.time = NaT;
commit_info.author_time = NaT;
commit_info.dirty = false;
if ~isempty(matlab.project.currentProject)
commit_info.project = currentProject;
else
commit_info.project = "";
end
commit_info.branch = "(unknown)";
benchmarks = arrayfun(@convertBenchMark, results);
s.machine_info = machine_info;
s.commit_info = commit_info;
s.benchmarks = benchmarks;
s.datetime = datetime("now");
s.version = "";
json = jsonencode(s);
function b = convertBenchMark(r)
b.group = missing;
b.name = r.Name;
b.fullname = string(r.TestActivity.TestResult(1).TestElement.BaseFolder) + filesep + r.Name;
b.params = missing;
b.param = missing;
b.extra_info = struct;
opts.disable_gc = false;
opts.timer = "tic/toc";
opts.min_rounds = 4;
opts.max_time = realmax;
opts.min_time = r.CalibrationValue;
opts.warmup = true;
b.options = opts;
mt = r.Samples.MeasuredTime;
stats.min = min(mt);
stats.max = max(mt);
stats.mean = mean(mt);
stats.stddev = std(mt);
stats.rounds = numel(mt);
stats.median = median(mt);
stats.iqr = iqr(mt);
stats.q1 = quantile(mt, .25);
stats.q3 = quantile(mt, .75);
iqr_outliers = nnz(...
mt > stats.mean + (stats.iqr/2) | ...
mt < stats.mean - (stats.iqr/2));
stats.iqr_outliers = iqr_outliers;
stddev_outliers = nnz(...
mt > stats.mean + stats.stddev | ...
mt < stats.mean - stats.stddev);
stats.stddev_outliers = stddev_outliers;
stats.outliers = iqr_outliers + ";" + stddev_outliers;
stats.ld15iqr = NaN;
stats.hd15iqr = NaN;
totalTime = sum(mt);
stats.ops = stats.rounds/totalTime;
stats.total = totalTime;
stats.iterations = 1;
b.stats = stats;