]> git.saurik.com Git - apple/xnu.git/blob - bsd/dev/arm64/sysctl.c
xnu-4570.20.62.tar.gz
[apple/xnu.git] / bsd / dev / arm64 / sysctl.c
1 /*
2 * Copyright (c) 2003-2007 Apple Inc. All rights reserved.
3 */
4 #include <sys/param.h>
5 #include <sys/kernel.h>
6 #include <sys/sysctl.h>
7
8 #include <machine/machine_routines.h>
9
10 extern uint64_t wake_abstime;
11
12 static
13 SYSCTL_QUAD(_machdep, OID_AUTO, wake_abstime,
14 CTLFLAG_RD, &wake_abstime,
15 "Absolute Time at the last wakeup");
16
17 static int
18 sysctl_time_since_reset SYSCTL_HANDLER_ARGS
19 {
20 #pragma unused(arg1, arg2, oidp)
21 int error = 0;
22 uint64_t return_value = 0;
23
24 return_value = ml_get_time_since_reset();
25
26 SYSCTL_OUT(req, &return_value, sizeof(return_value));
27
28 return error;
29 }
30
31 SYSCTL_PROC(_machdep, OID_AUTO, time_since_reset,
32 CTLFLAG_RD | CTLTYPE_QUAD | CTLFLAG_LOCKED,
33 0, 0, sysctl_time_since_reset, "I",
34 "Continuous time since last SOC boot/wake started");
35
36 static int
37 sysctl_wake_conttime SYSCTL_HANDLER_ARGS
38 {
39 #pragma unused(arg1, arg2, oidp)
40 int error = 0;
41 uint64_t return_value = 0;
42
43 return_value = ml_get_conttime_wake_time();
44
45 SYSCTL_OUT(req, &return_value, sizeof(return_value));
46
47 return error;
48 }
49
50 SYSCTL_PROC(_machdep, OID_AUTO, wake_conttime,
51 CTLFLAG_RD | CTLTYPE_QUAD | CTLFLAG_LOCKED,
52 0, 0, sysctl_wake_conttime, "I",
53 "Continuous Time at the last wakeup");
54
55