diff options
author | fche <fche> | 2005-08-19 21:50:42 +0000 |
---|---|---|
committer | fche <fche> | 2005-08-19 21:50:42 +0000 |
commit | 98afd80eb5038542fa3a98c75528524b5d4287b6 (patch) | |
tree | 2b968e1c8523fd50596431e09f936290220a0d29 /runtime | |
parent | efc364eebf15dd7e8b6c93e155af83b6d3971752 (diff) | |
download | systemtap-steved-98afd80eb5038542fa3a98c75528524b5d4287b6.tar.gz systemtap-steved-98afd80eb5038542fa3a98c75528524b5d4287b6.tar.xz systemtap-steved-98afd80eb5038542fa3a98c75528524b5d4287b6.zip |
2005-08-19 Frank Ch. Eigler <fche@elastic.org>
PR systemtap/1209
* tapsets.cxx
* elaborate.cxx (derived_probe_builder): Add get_param function.
* elaborate.h: Declare them.
* tapsets.cxx (dwarf_query::get_*_param): Call them.
(timer_derived_probe, timer_builder): New classes.
(register_standard_tapsets): Register timer.jiffies(N) and friend.
* translate.cxx (translate_pass): #include <linux/timers.h>.
* stap.1.in: Document timer.jiffies(N) probe points.
* testsuite/buildok/fourteen.stp: New test.
2005-08-19 Frank Ch. Eigler <fche@elastic.org>
* arith.c (_stp_random_pm): New function.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/ChangeLog | 4 | ||||
-rw-r--r-- | runtime/arith.c | 24 |
2 files changed, 27 insertions, 1 deletions
diff --git a/runtime/ChangeLog b/runtime/ChangeLog index 05367f27..f4f791dd 100644 --- a/runtime/ChangeLog +++ b/runtime/ChangeLog @@ -1,3 +1,7 @@ +2005-08-19 Frank Ch. Eigler <fche@elastic.org> + + * arith.c (_stp_random_pm): New function. + 2005-08-19 Martin Hunt <hunt@redhat.com> * print.c: Change ifdefs to STP_RELAYFS. diff --git a/runtime/arith.c b/runtime/arith.c index 175cc4e8..0200afa6 100644 --- a/runtime/arith.c +++ b/runtime/arith.c @@ -2,9 +2,10 @@ #define _ARITH_C_ /** @file arith. - * @brief Implements 64-bit signed division/multiplication. + * @brief Implements various arithmetic-related helper functions */ + struct context; void _stp_divmod64 (unsigned *errorcount, int64_t x, int64_t y, int64_t *quo, int64_t *rem); @@ -75,5 +76,26 @@ void _stp_divmod64 (unsigned *errorcount, int64_t x, int64_t y, } +/** Return a random integer between -n and n. + * @param n how far from zero to go. Make it positive but less than a million or so. + */ +int _stp_random_pm (int n) +{ + static unsigned long seed; + static int initialized_p = 0; + + if (unlikely (! initialized_p)) + { + seed = (unsigned long) jiffies; + initialized_p = 1; + } + + /* from glibc rand man page */ + seed = seed * 1103515245 + 12345; + + return (seed % (2*n+1)-n); +} + + #endif /* _ARITH_C_ */ |