blob: 61678feb00443b8d73fb4873f0a62894a061d81a [file] [log] [blame]
William Kurkianea869482019-04-09 15:16:11 -04001// +build !linux appengine
2
3/*
4 *
5 * Copyright 2018 gRPC authors.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
10 *
11 * http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 *
19 */
20
21package syscall
22
23import (
24 "net"
25 "time"
26
27 "google.golang.org/grpc/grpclog"
28)
29
30func init() {
31 grpclog.Info("CPU time info is unavailable on non-linux or appengine environment.")
32}
33
34// GetCPUTime returns the how much CPU time has passed since the start of this process.
35// It always returns 0 under non-linux or appengine environment.
36func GetCPUTime() int64 {
37 return 0
38}
39
40// Rusage is an empty struct under non-linux or appengine environment.
41type Rusage struct{}
42
43// GetRusage is a no-op function under non-linux or appengine environment.
44func GetRusage() (rusage *Rusage) {
45 return nil
46}
47
48// CPUTimeDiff returns the differences of user CPU time and system CPU time used
49// between two Rusage structs. It a no-op function for non-linux or appengine environment.
50func CPUTimeDiff(first *Rusage, latest *Rusage) (float64, float64) {
51 return 0, 0
52}
53
54// SetTCPUserTimeout is a no-op function under non-linux or appengine environments
55func SetTCPUserTimeout(conn net.Conn, timeout time.Duration) error {
56 return nil
57}
58
59// GetTCPUserTimeout is a no-op function under non-linux or appengine environments
60// a negative return value indicates the operation is not supported
61func GetTCPUserTimeout(conn net.Conn) (int, error) {
62 return -1, nil
63}