Switch back to mallinfo in SkSL memory benchmark
Early results from measuring RSS (via /proc or similar) shows results that aren't very accurate or stable. From previous detailed testing, I know that mallinfo gives a good answer. We only really need results from ~one machine, so limiting to UNIX bots isn't a big deal. Change-Id: I73af043720b1204e1da436e2e63b19766a97a9a2 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/301445 Reviewed-by: Mike Klein <mtklein@google.com> Commit-Queue: Brian Osman <brianosman@google.com>
This commit is contained in:
parent
61a70fb1ec
commit
24b8a8cd1a
@ -8,7 +8,6 @@
|
||||
#include "bench/ResultsWriter.h"
|
||||
#include "bench/SkSLBench.h"
|
||||
#include "src/sksl/SkSLCompiler.h"
|
||||
#include "tools/ProcStats.h"
|
||||
|
||||
class SkSLBench : public Benchmark {
|
||||
public:
|
||||
@ -119,23 +118,32 @@ DEF_BENCH(return new SkSLBench("huge", R"(
|
||||
}
|
||||
)"); )
|
||||
|
||||
#if defined(SK_BUILD_FOR_UNIX)
|
||||
|
||||
#include <malloc.h>
|
||||
|
||||
// These benchmarks aren't timed, they produce memory usage statistics. They run standalone, and
|
||||
// directly add their results to the nanobench log.
|
||||
void RunSkSLMemoryBenchmarks(NanoJSONResultsWriter* log) {
|
||||
auto bench = [log](const char* name, int64_t bytes) {
|
||||
auto heap_bytes_used = []() { return mallinfo().uordblks; };
|
||||
auto bench = [log](const char* name, int bytes) {
|
||||
log->beginObject(name); // test
|
||||
log->beginObject("meta"); // config
|
||||
log->appendS64("bytes", bytes); // sub_result
|
||||
log->appendS32("bytes", bytes); // sub_result
|
||||
log->endObject(); // config
|
||||
log->endObject(); // test
|
||||
};
|
||||
|
||||
{
|
||||
int64_t before = sk_tools::getCurrResidentSetSizeBytes();
|
||||
int before = heap_bytes_used();
|
||||
SkSL::Compiler compiler;
|
||||
int64_t after = sk_tools::getCurrResidentSetSizeBytes();
|
||||
if (before > 0 && after > 0) {
|
||||
bench("sksl_compiler_baseline", after - before);
|
||||
}
|
||||
int after = heap_bytes_used();
|
||||
bench("sksl_compiler_baseline", after - before);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void RunSkSLMemoryBenchmarks(NanoJSONResultsWriter*) {}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user