blob: 4c8592a81f27cf39b9a764d83ad6201b529ecc23 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
// timestamp tapset
// Copyright (C) 2005-2006 Red Hat Inc.
// Copyright (C) 2006 Intel Corporation.
//
// This file is part of systemtap, and is free software. You can
// redistribute it and/or modify it under the terms of the GNU General
// Public License (GPL); either version 2, or (at your option) any
// later version.
///<chapter id="timestamp_stp">
/// <title>Timestamp Functions</title>
/// <para>
/// Each timestamp function returns a value to indicate when
/// the function is executed.
/// Thus, these returned values can be used to indicate
/// when an event occurs, provide an ordering for events, or compute
/// the amount of time elapsed between to time stamps.
/// </para>
%{
#include <linux/time.h>
%}
///<formalpara id="get_cycles">
/// <title>get_cycles:long()</title>
/// <indexterm><primary>get_cycles</primary></indexterm>
/// <para>
/// Return the processor cycle counter value, or 0 if unavailable.
/// </para>
///</formalpara>
function get_cycles:long () %{ /* pure */
cycles_t c = get_cycles();
THIS->__retvalue = (int64_t) c;
%}
///<formalpara id="gettimeofday_ns">
/// <title>gettimeofday_ns:long ()</title>
/// <indexterm><primary>gettimeofday_ns</primary></indexterm>
/// <para>
/// Return the number of nanoseconds since the UNIX epoch.
/// </para>
///</formalpara>
function gettimeofday_ns:long () %{ /* pure */
/* NOTE: we can't use do_gettimeofday because we could be called from a
* context where xtime_lock is already held. See bug #2525. */
THIS->__retvalue = _stp_gettimeofday_ns();
%}
///<formalpara id="gettimeofday_us">
/// <title>gettimeofday_us:long ()</title>
/// <indexterm><primary>gettimeofday_us</primary></indexterm>
/// <para>
/// Return the number of microseconds since the UNIX epoch.
/// </para>
///</formalpara>
function gettimeofday_us:long () {
return gettimeofday_ns() / 1000;
}
///<formalpara id="gettimeofday_ms">
/// <title>gettimeofday_ms:long ()</title>
/// <indexterm><primary>gettimeofday_ms</primary></indexterm>
/// <para>
/// Return the number of milliseconds since the UNIX epoch.
/// </para>
///</formalpara>
function gettimeofday_ms:long () {
return gettimeofday_ns() / 1000000;
}
///<formalpara id="gettimeofday_s">
/// <title>gettimeofday_s:long ()</title>
/// <indexterm><primary>gettimeofday_s</primary></indexterm>
/// <para>
/// Return the number of seconds since the UNIX epoch.
/// </para>
///</formalpara>
function gettimeofday_s:long () {
return gettimeofday_ns() / 1000000000;
}
// likewise jiffies, monotonic_clock ...
///</chapter>
|