Skip to content

Commit ea45959

Browse files
benjirewisBenjamin Rewis
authored and
Benjamin Rewis
committed
GODRIVER-2169 Use perf.send instead of json.send (#772)
1 parent 3e89c64 commit ea45959

File tree

3 files changed

+27
-21
lines changed

3 files changed

+27
-21
lines changed

.evergreen/config.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,8 @@ functions:
283283
sh ${PROJECT_DIRECTORY}/.evergreen/run-tests.sh
284284
285285
send-perf-data:
286-
- command: json.send
286+
- command: perf.send
287287
params:
288-
name: perf
289288
file: src/go.mongodb.org/mongo-driver/perf.json
290289

291290
run-enterprise-auth-tests:

benchmark/harness_main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func DriverBenchmarkMain() int {
3737
output = append(output, evg...)
3838
}
3939

40-
evgOutput, err := json.MarshalIndent(map[string]interface{}{"results": output}, "", " ")
40+
evgOutput, err := json.MarshalIndent(output, "", " ")
4141
if err != nil {
4242
return 1
4343
}

benchmark/harness_results.go

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ type BenchResult struct {
2323
hasErrors *bool
2424
}
2525

26+
type Metric struct {
27+
Name string `json:"name"`
28+
Value interface{} `json:"value"`
29+
}
30+
2631
func (r *BenchResult) EvergreenPerfFormat() ([]interface{}, error) {
2732
timings := r.timings()
2833

@@ -43,33 +48,35 @@ func (r *BenchResult) EvergreenPerfFormat() ([]interface{}, error) {
4348

4449
out := []interface{}{
4550
map[string]interface{}{
46-
"name": r.Name + "-throughput",
47-
"results": map[string]interface{}{
48-
"1": map[string]interface{}{
49-
"seconds": r.Duration.Round(time.Millisecond).Seconds(),
50-
"ops_per_second": r.getThroughput(median),
51-
"ops_per_second_values": []float64{
52-
r.getThroughput(min),
53-
r.getThroughput(max),
54-
},
51+
"info": map[string]interface{}{
52+
"test_name": r.Name + "-throughput",
53+
"args": map[string]interface{}{
54+
"threads": 1,
5555
},
5656
},
57+
"metrics": []Metric{
58+
{Name: "seconds", Value: r.Duration.Round(time.Millisecond).Seconds()},
59+
{Name: "ops_per_second", Value: r.getThroughput(median)},
60+
{Name: "ops_per_second_min", Value: r.getThroughput(min)},
61+
{Name: "ops_per_second_max", Value: r.getThroughput(max)},
62+
},
5763
},
5864
}
5965

6066
if r.DataSize > 0 {
6167
out = append(out, interface{}(map[string]interface{}{
62-
"name": r.Name + "-MB-adjusted",
63-
"results": map[string]interface{}{
64-
"1": map[string]interface{}{
65-
"seconds": r.Duration.Round(time.Millisecond).Seconds(),
66-
"ops_per_second": r.adjustResults(median),
67-
"ops_per_second_values": []float64{
68-
r.adjustResults(min),
69-
r.adjustResults(max),
70-
},
68+
"info": map[string]interface{}{
69+
"test_name": r.Name + "-MB-adjusted",
70+
"args": map[string]interface{}{
71+
"threads": 1,
7172
},
7273
},
74+
"metrics": []Metric{
75+
{Name: "seconds", Value: r.Duration.Round(time.Millisecond).Seconds()},
76+
{Name: "ops_per_second", Value: r.adjustResults(median)},
77+
{Name: "ops_per_second_min", Value: r.adjustResults(min)},
78+
{Name: "ops_per_second_max", Value: r.adjustResults(max)},
79+
},
7380
}))
7481
}
7582

0 commit comments

Comments
 (0)