fix: set perf monitor interval for Sysmontap

This commit is contained in:
debugtalk
2022-11-29 21:59:52 +08:00
parent 32fa471f2c
commit 11baeb415f
2 changed files with 11 additions and 3 deletions

View File

@@ -5,6 +5,7 @@ import (
"encoding/binary"
"encoding/json"
"fmt"
"log"
"net"
"strconv"
"time"
@@ -179,10 +180,13 @@ type perfdSysmontap struct {
func (c *perfdSysmontap) Start() (data <-chan []byte, err error) {
// set config
interval := time.Millisecond * time.Duration(c.options.OutputInterval)
log.Printf("set sysmontap sample interval: %dms\n", c.options.OutputInterval)
config := map[string]interface{}{
"bm": 0,
"cpuUsage": true,
"sampleInterval": time.Second * 1, // 1s
"sampleInterval": interval, // time.Duration
"ur": c.options.OutputInterval, // 输出频率
"procAttrs": c.options.ProcessAttributes, // process performance
"sysAttrs": c.options.SystemAttributes, // system performance
@@ -740,7 +744,7 @@ func (c *perfdGraphicsOpengl) Start() (data <-chan []byte, err error) {
if _, err = c.i.call(
instrumentsServiceGraphicsOpengl,
"setSamplingRate:",
float64(c.options.OutputInterval)/100,
float64(c.options.OutputInterval)/100, // FIXME: unable to set sampling rate, always 1.0
); err != nil {
return nil, err
}