mirror of
https://github.com/scylladb/scylladb.git
synced 2026-04-25 02:50:33 +00:00
Calculate and display the number of memory allocations and tasks executed per operation. Sample results (--smp 1): 180022.46 tps (90 allocs/op, 20 tasks/op) 178963.44 tps (90 allocs/op, 20 tasks/op) 178702.41 tps (90 allocs/op, 20 tasks/op) 177679.74 tps (90 allocs/op, 20 tasks/op) 179539.36 tps (90 allocs/op, 20 tasks/op) median 178963.44 tps (90 allocs/op, 20 tasks/op) median absolute deviation: 575.92 maximum: 180022.46 minimum: 177679.74 This allows less noisy tracking of how some changes impact performance.
68 lines
2.1 KiB
C++
68 lines
2.1 KiB
C++
/*
|
|
* Copyright (C) 2021 ScyllaDB
|
|
*/
|
|
|
|
/*
|
|
* This file is part of Scylla.
|
|
*
|
|
* Scylla is free software: you can redistribute it and/or modify
|
|
* it under the terms of the GNU Affero General Public License as published by
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* Scylla is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with Scylla. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#include "perf.hh"
|
|
#include <seastar/core/reactor.hh>
|
|
#include <seastar/core/memory.hh>
|
|
#include "seastarx.hh"
|
|
|
|
void scheduling_latency_measurer::schedule_tick() {
|
|
seastar::schedule(make_task(default_scheduling_group(), [self = weak_from_this()] () mutable {
|
|
if (self) {
|
|
self->tick();
|
|
}
|
|
}));
|
|
}
|
|
|
|
std::ostream& operator<<(std::ostream& out, const scheduling_latency_measurer& slm) {
|
|
auto to_ms = [] (int64_t nanos) {
|
|
return float(nanos) / 1e6;
|
|
};
|
|
return out << sprint("{count: %d, "
|
|
//"min: %.6f [ms], "
|
|
//"50%%: %.6f [ms], "
|
|
//"90%%: %.6f [ms], "
|
|
"99%%: %.6f [ms], "
|
|
"max: %.6f [ms]}",
|
|
slm.histogram().count(),
|
|
//to_ms(slm.min().count()),
|
|
//to_ms(slm.histogram().percentile(0.5)),
|
|
//to_ms(slm.histogram().percentile(0.9)),
|
|
to_ms(slm.histogram().percentile(0.99)),
|
|
to_ms(slm.max().count()));
|
|
}
|
|
|
|
|
|
executor_shard_stats
|
|
executor_shard_stats_snapshot() {
|
|
return executor_shard_stats{
|
|
.allocations = memory::stats().mallocs(),
|
|
.tasks_executed = engine().get_sched_stats().tasks_processed,
|
|
};
|
|
}
|
|
|
|
std::ostream&
|
|
operator<<(std::ostream& os, const perf_result& result) {
|
|
fmt::print(os, "{:.2f} tps ({:.0} allocs/op, {:.0} tasks/op)",
|
|
result.throughput, result.mallocs_per_op, result.tasks_per_op);
|
|
return os;
|
|
}
|