-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
273 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
.DS_Store | ||
/.build | ||
/Packages | ||
xcuserdata/ | ||
DerivedData/ | ||
.swiftpm/configuration/registries.json | ||
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata | ||
.netrc | ||
.benchmarkBaselines/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// swift-tools-version:5.7 | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftPrometheus open source project | ||
// | ||
// Copyright (c) 2018-2023 SwiftPrometheus project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of SwiftPrometheus project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
import Prometheus | ||
|
||
public func runCounterBench(_ iterations: Range<Int>) { | ||
let ctr = registry.makeCounter(name: "counter_1", labels: makeLabels(1)) | ||
for _ in iterations { | ||
blackHole(ctr.increment()) | ||
} | ||
} | ||
|
||
public func setupCounterBench() -> () -> Void { | ||
let ctr = registry.makeCounter(name: "counter_2", labels: makeLabels(2)) | ||
return { | ||
blackHole(ctr.increment()) | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Benchmarks/Benchmarks/PrometheusBenchmarks/DurationHistogram.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
// swift-tools-version:5.7 | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftPrometheus open source project | ||
// | ||
// Copyright (c) 2018-2023 SwiftPrometheus project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of SwiftPrometheus project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
import Prometheus | ||
|
||
public func runDurationHistogramBench(_ iterations: Range<Int>) { | ||
let histogram = registry.makeDurationHistogram(name: "histogram_1", labels: makeLabels(3), | ||
buckets: [ | ||
.milliseconds(100), | ||
.milliseconds(250), | ||
.milliseconds(500), | ||
.seconds(1), | ||
]) | ||
for _ in iterations { | ||
blackHole(histogram.record(Duration.milliseconds(400))) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// swift-tools-version:5.7 | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftPrometheus open source project | ||
// | ||
// Copyright (c) 2018-2023 SwiftPrometheus project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of SwiftPrometheus project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
import Prometheus | ||
|
||
public func runGaugeBench(_ iterations: Range<Int>) { | ||
let gauge = registry.makeGauge(name: "gauge_1", labels: makeLabels(2)) | ||
for _ in iterations { | ||
blackHole(gauge.increment()) | ||
} | ||
} | ||
|
||
public func setupGaugeBench() -> () -> Void { | ||
let gauge = registry.makeGauge(name: "gauge_1", labels: makeLabels(2)) | ||
return { | ||
blackHole(gauge.increment()) | ||
} | ||
} |
43 changes: 43 additions & 0 deletions
43
Benchmarks/Benchmarks/PrometheusBenchmarks/RegistryEmit.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// swift-tools-version:5.7 | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// This source file is part of the SwiftPrometheus open source project | ||
// | ||
// Copyright (c) 2018-2023 SwiftPrometheus project authors | ||
// Licensed under Apache License v2.0 | ||
// | ||
// See LICENSE.txt for license information | ||
// See CONTRIBUTORS.txt for the list of SwiftPrometheus project authors | ||
// | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// | ||
//===----------------------------------------------------------------------===// | ||
|
||
import Benchmark | ||
import Prometheus | ||
|
||
public func setupRegistryExport(numberOfMetrics: Int) -> () -> Void { | ||
let registryExport = PrometheusCollectorRegistry() | ||
|
||
var counterArray = [Counter]() | ||
var gaugeArray = [Gauge]() | ||
var buffer = [UInt8]() | ||
|
||
let counterExportSize = 620_000 | ||
counterArray.reserveCapacity(numberOfMetrics) | ||
gaugeArray.reserveCapacity(numberOfMetrics) | ||
buffer.reserveCapacity(counterExportSize) | ||
|
||
for i in 0..<(numberOfMetrics / 2) { | ||
let counter = registryExport.makeCounter(name: "http_requests_total", labels: makeLabels(i)) | ||
counter.increment() | ||
counterArray.append(counter) | ||
|
||
let gauge = registryExport.makeGauge(name: "export_gauge_\(i)", labels: makeLabels(i)) | ||
gauge.increment() | ||
gaugeArray.append(gauge) | ||
} | ||
return { | ||
blackHole(registryExport.emit(into: &buffer)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.9/PrometheusBenchmarks.Counter_#1.p90.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"mallocCountTotal" : 1 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.9/PrometheusBenchmarks.Counter_#2.p90.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"mallocCountTotal" : 0 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.9/PrometheusBenchmarks.DurationHistogram.p90.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"mallocCountTotal" : 2 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.9/PrometheusBenchmarks.Gauge.p90.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"mallocCountTotal" : 1 | ||
} |
3 changes: 3 additions & 0 deletions
3
Benchmarks/Thresholds/5.9/PrometheusBenchmarks.RegistryEmit_-_5000_metrics.p90.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"mallocCountTotal" : 0 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/bin/bash | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftNIO open source project | ||
## | ||
## Copyright (c) 2023 Apple Inc. and the SwiftNIO project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftNIO project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
##===----------------------------------------------------------------------===## | ||
## | ||
## This source file is part of the SwiftCertificates open source project | ||
## | ||
## Copyright (c) 2023 Apple Inc. and the SwiftCertificates project authors | ||
## Licensed under Apache License v2.0 | ||
## | ||
## See LICENSE.txt for license information | ||
## See CONTRIBUTORS.txt for the list of SwiftCertificates project authors | ||
## | ||
## SPDX-License-Identifier: Apache-2.0 | ||
## | ||
##===----------------------------------------------------------------------===## | ||
|
||
set -eu | ||
set -o pipefail | ||
|
||
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | ||
target_repo=${2-"$here/.."} | ||
|
||
for f in 57 58 59 510 -nightly; do | ||
echo "swift$f" | ||
|
||
docker_file=$(if [[ "$f" == "-nightly" ]]; then f=main; fi && ls "$target_repo/docker/docker-compose."*"$f"*".yaml") | ||
|
||
docker-compose -f docker/docker-compose.yaml -f $docker_file run update-benchmark-baseline | ||
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.