本文整理汇总了Golang中github.com/cockroachdb/cockroach/util/hlc.Clock.PhysicalNow方法的典型用法代码示例。如果您正苦于以下问题:Golang Clock.PhysicalNow方法的具体用法?Golang Clock.PhysicalNow怎么用?Golang Clock.PhysicalNow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/cockroachdb/cockroach/util/hlc.Clock
的用法示例。
在下文中一共展示了Clock.PhysicalNow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: MakeRuntimeStatSampler
// MakeRuntimeStatSampler constructs a new RuntimeStatSampler object.
func MakeRuntimeStatSampler(clock *hlc.Clock) RuntimeStatSampler {
// Construct the build info metric. It is constant.
// We first build set the labels on the metadata.
info := build.GetInfo()
timestamp, err := info.Timestamp()
if err != nil {
// We can't panic here, tests don't have a build timestamp.
log.Warningf(context.TODO(), "Could not parse build timestamp: %v", err)
}
metaBuildTimestamp.AddLabel("tag", info.Tag)
metaBuildTimestamp.AddLabel("go_version", info.GoVersion)
buildTimestamp := metric.NewGauge(metaBuildTimestamp)
buildTimestamp.Update(timestamp)
return RuntimeStatSampler{
clock: clock,
startTimeNanos: clock.PhysicalNow(),
CgoCalls: metric.NewGauge(metaCgoCalls),
Goroutines: metric.NewGauge(metaGoroutines),
GoAllocBytes: metric.NewGauge(metaGoAllocBytes),
GoTotalBytes: metric.NewGauge(metaGoTotalBytes),
CgoAllocBytes: metric.NewGauge(metaCgoAllocBytes),
CgoTotalBytes: metric.NewGauge(metaCgoTotalBytes),
GcCount: metric.NewGauge(metaGCCount),
GcPauseNS: metric.NewGauge(metaGCPauseNS),
GcPausePercent: metric.NewGaugeFloat64(metaGCPausePercent),
CPUUserNS: metric.NewGauge(metaCPUUserNS),
CPUUserPercent: metric.NewGaugeFloat64(metaCPUUserPercent),
CPUSysNS: metric.NewGauge(metaCPUSysNS),
CPUSysPercent: metric.NewGaugeFloat64(metaCPUSysPercent),
Rss: metric.NewGauge(metaRSS),
Uptime: metric.NewGauge(metaUptime),
BuildTimestamp: buildTimestamp,
}
}