/usr/share/systemtap/tapset/speculative.stp is in systemtap-common 2.6-0.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | // Speculative tapset
// Copyright (C) 2011 Red Hat Inc.
//
// 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.
global _spec_id
global _spec_counter
global _spec_buff
global _spec_discard
/**
* sfunction speculation - Allocate a new id for speculative output
*
* The speculation() function is called when a new speculation buffer is needed.
* It returns an id for the speculative output.
* There can be multiple threads being speculated on concurrently.
* This id is used by other speculation functions to keep the threads
* separate.
*/
function speculation:long ()
{
_spec_id += 1
return _spec_id
}
/**
* sfunction speculate - Store a string for possible output later
* @id: buffer id to store the information in
* @output: string to write out when commit occurs
*
* Add a string to the speculaive buffer for id.
*/
function speculate (id:long, output:string)
{
_spec_counter[id] += 1
_spec_buff[id, _spec_counter[id]] = output
}
function _spec_erase (id:long) {
foreach([i, counter] in _spec_discard)
delete _spec_buff[i, counter]
delete _spec_discard
}
/**
* sfunction discard - Discard all output related to a speculation buffer
* @id: of the buffer to store the information in
*
*/
function discard (id:long)
{
foreach([i, counter] in _spec_buff)
if (i==id) _spec_discard[i, counter] = 1
_spec_erase (id)
}
/**
* sfunction commit - Write out all output related to a speculation buffer
* @id: of the buffer to store the information in
*
* Output all the output for @id in the order that it was entered into
* the speculative buffer by speculative().
*/
function commit (id:long)
{
foreach([i, counter+] in _spec_buff) {
if (i==id) {
printf("%s", _spec_buff[i, counter])
_spec_discard[i, counter] = 1
}
}
_spec_erase (id)
}
|