Files
visor/pkg/sentry/time/clock_id.go
T
Luis Capelo aa9030c7fe nvproxy: expose CLOCK_MONOTONIC_RAW as a distinct clock for capProfiling
GPU profilers (Nsight Systems/CUPTI) build their trace timeline from
CLOCK_MONOTONIC_RAW. gVisor serves CLOCK_MONOTONIC_RAW as an alias of
CLOCK_MONOTONIC, this will drift from CLOCK_MONOTONIC_RAW breaking profiling.

When nvproxy is enabled with `capProfiling`, this change exposes
CLOCK_MONOTONIC_RAW as a clock distinct from CLOCK_MONOTONIC that tracks the
host's CLOCK_MONOTONIC_RAW (absolute, unadjusted). CLOCK_MONOTONIC is
unchanged. When profiling is disabled, CLOCK_MONOTONIC_RAW continues to alias
CLOCK_MONOTONIC as before.
2026-08-14 19:42:03 +00:00

44 lines
1.1 KiB
Go

// Copyright 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package time
import (
"strconv"
)
// ClockID is a Linux clock identifier.
type ClockID int32
// These are the supported Linux clock identifiers.
const (
Realtime ClockID = 0
Monotonic ClockID = 1
MonotonicRaw ClockID = 4
)
// String implements fmt.Stringer.String.
func (c ClockID) String() string {
switch c {
case Realtime:
return "Realtime"
case Monotonic:
return "Monotonic"
case MonotonicRaw:
return "MonotonicRaw"
default:
return strconv.Itoa(int(c))
}
}