| 1 |
// timestamp tapset |
| 2 |
// Copyright (C) 2005-2006 Red Hat Inc. |
| 3 |
// Copyright (C) 2006 Intel Corporation. |
| 4 |
// |
| 5 |
// This file is part of systemtap, and is free software. You can |
| 6 |
// redistribute it and/or modify it under the terms of the GNU General |
| 7 |
// Public License (GPL); either version 2, or (at your option) any |
| 8 |
// later version. |
| 9 |
// <tapsetdescription> |
| 10 |
// Each timestamp function returns a value to indicate when a function is executed. These |
| 11 |
//returned values can then be used to indicate when an event occurred, provide an ordering for events, |
| 12 |
//or compute the amount of time elapsed between two time stamps. |
| 13 |
// </tapsetdescription> |
| 14 |
|
| 15 |
/** |
| 16 |
* sfunction get_cycles - Processor cycle count |
| 17 |
* |
| 18 |
* Description: This function returns the processor cycle counter value |
| 19 |
* if available, else it returns zero. The cycle counter is free running |
| 20 |
* and unsynchronized on each processor. Thus, the order of events cannot |
| 21 |
* determined by comparing the results of the get_cycles function on |
| 22 |
* different processors. |
| 23 |
*/ |
| 24 |
function get_cycles:long () %{ /* pure */ /* unprivileged */ |
| 25 |
cycles_t c = get_cycles(); |
| 26 |
STAP_RETVALUE = (int64_t) c; |
| 27 |
%} |
| 28 |
|
| 29 |
|
| 30 |
/** |
| 31 |
* sfunction jiffies - Kernel jiffies count |
| 32 |
* |
| 33 |
* Description: This function returns the value of the kernel jiffies |
| 34 |
* variable. This value is incremented periodically by timer interrupts, |
| 35 |
* and may wrap around a 32-bit or 64-bit boundary. See HZ(). |
| 36 |
*/ |
| 37 |
function jiffies:long () %{ /* pure */ /* unprivileged */ |
| 38 |
STAP_RETVALUE = (int64_t) jiffies; |
| 39 |
%} |
| 40 |
|
| 41 |
|
| 42 |
/** |
| 43 |
* sfunction HZ - Kernel HZ |
| 44 |
* |
| 45 |
* Description: This function returns the value of the kernel HZ macro, |
| 46 |
* which corresponds to the rate of increase of the jiffies value. |
| 47 |
*/ |
| 48 |
function HZ:long () %{ /* pure */ /* unprivileged */ |
| 49 |
STAP_RETVALUE = (int64_t) HZ; |
| 50 |
%} |