Skip to content

Commit

Permalink
fix: remove undefined gethostname getrusage
Browse files Browse the repository at this point in the history
  • Loading branch information
ludamad0 committed Jan 24, 2024
1 parent bc1bb4c commit 9b721b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/sysinfo.cc
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,10 @@ std::string GetSystemName() {
str += std::to_string(arch_version_struct.arch_version);
}
return str;
// <aztec> dont rely on gethostname
#elif defined(__wasm__)
return "wasm";
// </aztec>
#else
#ifndef HOST_NAME_MAX
#ifdef BENCHMARK_HAS_SYSCTL // BSD/Mac doesn't have HOST_NAME_MAX defined
Expand Down
6 changes: 6 additions & 0 deletions src/timers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ double ProcessCPUUsage() {
if (clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &spec) == 0)
return MakeTime(spec);
DiagnoseAndExit("clock_gettime(CLOCK_PROCESS_CPUTIME_ID, ...) failed");
#elif defined(__wasm__)
// <aztec>
// We define a fallback that works with wasi. We return something
// obviously wrong - we don't want per-thread timing.
return 0;
// </ aztec>
#else
struct rusage ru;
if (getrusage(RUSAGE_SELF, &ru) == 0) return MakeTime(ru);
Expand Down

0 comments on commit 9b721b1

Please sign in to comment.