From 32c34330a542dac845e9a61982919ccec7269bdc Mon Sep 17 00:00:00 2001 From: Alex Browne Date: Mon, 4 Nov 2019 14:39:44 -0800 Subject: [PATCH] Mock getProcessCPUTime for WASM environments --- metrics/cpu_js.go | 9 +++++++++ metrics/cpu_syscall.go | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) create mode 100644 metrics/cpu_js.go diff --git a/metrics/cpu_js.go b/metrics/cpu_js.go new file mode 100644 index 0000000000..7a5f1669be --- /dev/null +++ b/metrics/cpu_js.go @@ -0,0 +1,9 @@ +// +build js,wasm + +package metrics + +// getProcessCPUTime is mocked for js/wasm environments. Currently it alwasy +// returns 0. +func getProcessCPUTime() int64 { + return 0 +} diff --git a/metrics/cpu_syscall.go b/metrics/cpu_syscall.go index e245453e82..1d6f3b5c7c 100644 --- a/metrics/cpu_syscall.go +++ b/metrics/cpu_syscall.go @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Lesser General Public License // along with the go-ethereum library. If not, see . -// +build !windows +// +build !windows,!js package metrics