staticvoid BM_mallinfo(benchmark::State& state) {
pthread_t t[NTHREADS]; void* object[NTHREADS]; // Create threads to populate thread-local arenas, if any.
thread_count = 0; for (int i = 0; i < 5; i++) { int res = pthread_create(t + i, NULL, thread_func, object + i); if (res != 0) {
errx(1, "ERROR: pthread_create failed");
}
} while (thread_count != NTHREADS) {
sched_yield();
} for (auto _ : state) {
benchmark::DoNotOptimize(mallinfo().uordblks);
} for (int i = 0; i < 5; i++) { int res = pthread_join(t[i], NULL); if (res != 0) {
errx(1, "ERROR: pthread_join failed");
}
free(object[i]);
}
}
BIONIC_BENCHMARK(BM_mallinfo);
static constexpr int BUF_SIZE = 100;
staticvoid BM_read_statm(benchmark::State& state) { char buf[BUF_SIZE]; int statm_fd = open("/proc/self/statm", O_RDONLY); if (statm_fd == -1) {
errx(1, "ERROR: Open failed");
} for (auto _ : state) {
off_t result = lseek(statm_fd, 0/* offset */, SEEK_SET); if (result == (off_t) -1) {
errx(1, "ERROR: lseek to beginning failed");
}
ssize_t nread = read(statm_fd, buf, BUF_SIZE); if (nread < 13 || nread > 50) {
errx(1, "ERROR: Implausible read result; result = %zd", nread);
} // We should really add the parsing overhead for the result; but that should be < 100 nsecs // if we tweak it enough.
} if (close(statm_fd) == -1) {
errx(1, "ERROR: Close failed");
}
}
BIONIC_BENCHMARK(BM_read_statm);
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.