mirror of
https://github.com/hanzoai/visor.git
synced 2026-09-24 17:04:14 +00:00
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.
44 lines
1.1 KiB
Go
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))
|
|
}
|
|
}
|