blob: d0c89df8c22020c97afffb9165fbebace4d0581d (
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
|
// 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.
%{
#include <linux/time.h>
%}
// return processor cycle counter (if any)
function get_cycles:long () %{ /* pure */
cycles_t c = get_cycles();
THIS->__retvalue = (int64_t) c;
%}
// return in microseconds since epoch
function gettimeofday_us: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_us();
%}
// return in milliseconds since epoch
function gettimeofday_ms:long () {
return gettimeofday_us() / 1000;
}
// return in seconds since epoch
function gettimeofday_s:long () {
return gettimeofday_us() / 1000000;
}
// likewise jiffies, monotonic_clock ...
|