aboutsummaryrefslogtreecommitdiff
path: root/src/runtime/metrics/sample.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/runtime/metrics/sample.go')
-rw-r--r--src/runtime/metrics/sample.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/runtime/metrics/sample.go b/src/runtime/metrics/sample.go
index c7a3fc424a..b4b0979aa6 100644
--- a/src/runtime/metrics/sample.go
+++ b/src/runtime/metrics/sample.go
@@ -4,6 +4,11 @@
package metrics
+import (
+ _ "runtime" // depends on the runtime via a linkname'd function
+ "unsafe"
+)
+
// Sample captures a single metric sample.
type Sample struct {
// Name is the name of the metric sampled.
@@ -16,6 +21,9 @@ type Sample struct {
Value Value
}
+// Implemented in the runtime.
+func runtime_readMetrics(unsafe.Pointer, int, int)
+
// Read populates each Value field in the given slice of metric samples.
//
// Desired metrics should be present in the slice with the appropriate name.
@@ -25,5 +33,5 @@ type Sample struct {
// will have the value populated as KindBad to indicate that the name is
// unknown.
func Read(m []Sample) {
- panic("unimplemented")
+ runtime_readMetrics(unsafe.Pointer(&m[0]), len(m), cap(m))
}