summaryrefslogtreecommitdiffstats
path: root/tapset/timestamp.stp
blob: 1980932adde4fb8726edf754f89bef113fb4c8d3 (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
// 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.
// <tapsetdescription>
// Each timestamp function returns a value to indicate when a function is executed. These 
//returned values can then be used to indicate when an event occurred, provide an ordering for events, 
//or compute the amount of time elapsed between two time stamps.
// </tapsetdescription>
/**
 * sfunction get_cycles - Processor cycle count.
 *
 *  Return the processor cycle counter value, or 0 if unavailable.
 */
function get_cycles:long () %{ /* pure */ /* unprivileged */
  cycles_t c = get_cycles();
  THIS->__retvalue = (int64_t) c;
%}

// likewise jiffies, monotonic_clock ...