summaryrefslogtreecommitdiffstats
path: root/runtime/time.c
Commit message (Collapse)AuthorAgeFilesLines
* PR10493: autoconf for cpu_khzWenji Huang2010-01-131-7/+5
| | | | | | * buildrun.cxx (output_cpu_khz): New function to check cpu_khz. (compile_pass): Invoke function output_cpu_khz. * runtime/time.c : Use STAPCONF_CPU_KHZ.
* Use proper types for do_divAnton Vorontsov2009-12-011-1/+2
| | | | | | | | | | | | | | | do_div accepts unsigned 64-bit integer type for dividend, signed types would cause do_div's typecheck fail: stat-common.c: In function 'needed_space': stat-common.c:50: error: comparison of distinct pointer types lacks a cast ...same errors in time.c and tapset-timers.cxx's generated code... A fix for time.c is special, on ppc32 cycles_t is 32-bit, so technically we don't need do_div, but since the whole _stp_gettimeofday_ns() operates on 64-bit types we'd better be safe and use uint64_t for the math. Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
* Add selective use of _stp_time_init/kill (PR9822)Josh Stone2009-02-231-1/+7
| | | | | | | | Our gettimeofday runtime has frequent wakeups to stay in sync with kernel time, but this is wasted effort if gettimeofday is not used in the script. This patch moves the calls to _stp_time_init and _stp_time_kill into begin and end/error probes, which only get pulled in if one of the gettimeofday variants is called.
* Use 'static' as much as possibleJosh Stone2009-01-281-6/+6
| | | | | | | | | | This change just inserts 'static' on runtime, tapset, and generated C functions and globals, so the compiler can do a better job of optimizing. My tests with small scripts show ~10% reduction in compile time and ~20% reduction in module size. Larger scripts may show less benefit, but I expect purely positive results.
* add some more wallpaper protection against cpu frequency = 0 in ↵Frank Ch. Eigler2008-12-091-1/+2
| | | | gettimeofday_* internals
* Fix on_each_cpu() call for kernels >2.6.26.Josh Stone2008-07-241-0/+4
| | | | | | | | This is a generalization of the patch from James Bottomley: http://sources.redhat.com/ml/systemtap/2008-q3/msg00220.html The on_each_cpu() change was merged *after* the 2.6.26 release, so I'm using an autoconf test instead of James' version check.
* PR6481: timer reset needs irqs reenabledFrank Ch. Eigler2008-05-051-2/+5
|
* Add support for memory allocation tracking.hunt2008-01-151-3/+2
|
* 2007-09-24 Masami Hiramatsu <mhiramat@redhat.com>hiramatu2007-09-241-32/+77
| | | | | | | | | | | | | | | | | | | | | PR 3916 * buildrun.cxx (compile_pass): Add new autoconf options for checking time related APIs. * time.c (stp_time_t): Rename cpufreq to freq. (__stp_get_freq): Rename from __stp_estimate_cpufreq. Use tsc_khz or cpu_khz if it is available. Use itc_freq on ia64. (__stp_ktime_get_real_ts): New function to get current kernel time. (__stp_time_timer_callback): Call __stp_ktime_get_real_ts to get base time. (__stp_init_time): Ditto. (__stp_constant_freq): New function to check the processor has constant frequency timestamp counter. (_stp_kill_time): Don't use the cpufreq notifier if the processor has constant frequency timestamp counter. (_stp_init_time): Ditto. * autoconf-ktime-get-real.c : New file. * autoconf-constant-tsc.c: Ditto. * autoconf-tsc-khz.c: Ditto.
* 2007-05-30 Martin Hunt <hunt@redhat.com>hunt2007-05-301-1/+7
| | | | | | | | | | | | Patch from Quentin Barnes. * arith.c: Add arm support for 64-bit division. * copy.c: Enable arm support. * loc2c-runtime.h: Ditto. * regs.[ch]: Ditto. * stack.c: Include stack-arm.c. * stack-arm.c: New file. * time.c (_stp_gettimeofday_ns): hack for arm. See PR 4569.
* 2007-03-12 Frank Ch. Eigler <fche@redhat.com>fche2007-03-121-1/+2
| | | | | | | | | | | | | PR 4179. Based on patch from Vasily Averin <vvs@sw.ru>: * time.c (_stp_init_time): Recover from partial failures. 2007-03-12 Frank Ch. Eigler <fche@redhat.com> PR 4179. Based on patch from Vasily Averin <vvs@sw.ru>: * procfs.c (_stp_register_procfs): Recover from partial failures. * transport.c (_stp_transport_open): Ditto.
* 2007-01-29 Martin Hunt <hunt@redhat.com>hunt2007-01-291-0/+1
| | | | | | | | | | * alloc.c (_stp_kmalloc): New function. Call kmalloc with the coirrect flags and track usage. (_stp_kzalloc): Ditto. * map.c: Use new alloc calls. * print.c: Ditto. * stat.c: Ditto. * time.c: Ditto.
* 2006-12-06 Josh Stone <joshua.i.stone@intel.com>jistone2006-12-071-27/+36
| | | | | | | | | | | | | | | | | | | | | PR 3623. * tapsets.cxx (timer_derived_probe_group::emit_module_decls): Restart the timers if we are in STARTING or RUNNING state. (hrtimer_derived_probe_group::emit_module_decls): Ditto. (be_derived_probe_group::emit_module_init): indicate error to the rest of the initialization if any begin probes fail. * translate.cxx (c_unparser::emit_module_init): Set the global error state on an initialization error so timers know to shut down. runtime/ * time.c (stp_timer_reregister): Add a global to control whether the gettimeofday timer should restart itself, for clean shutdown. (__stp_time_timer_callback): Check the global. (_stp_kill_time, _stp_init_time): Set the global. (_stp_gettimeofday_ns): Switch to preempt_enable_no_resched. * time.c (__stp_time_cpufreq_callback): Use the cpu# from the notifier. (_stp_init_time): No need to disable preemption around cpufreq init.
* 2006-10-09 Josh Stone <joshua.i.stone@intel.com>jistone2006-10-091-1/+18
| | | | | | | From David Wilder <dwilder@us.ibm.com> * time.c (__stp_estimate_cpufreq): Short-circuit on s390. (_stp_gettimeofday_ns): Use a fixed formula on s390 to convert TOD clocks to nanoseconds.
* 2006-09-26 Martin Hunt <hunt@redhat.com>hunt2006-09-261-16/+21
| | | | | | | * time.c (_stp_init_time): Use dynamic percpu allocations instead of evil static allocations. (_stp_kill_time): Free percpu allocations and set _stp_time to NULL so the timers are only deleted once.
* 2006-09-20 Josh Stone <joshua.i.stone@intel.com>jistone2006-09-201-32/+52
| | | | | | | | | | | | | | | | | | | | | | | | PR 3233 ./ * stapfuncs.5.in: Document new gettimeofday_ns. runtime/ * time.c (stp_time_t): Use ns for the base time, and freq is now kHz. (__stp_estimate_cpufreq): Compute kHz instead of MHz. (__stp_time_timer_callback, __stp_init_time): Compute base in ns. (__stp_time_cpufreq_callback): Record kHz instead of MHz. (_stp_init_time): Record kHz, and disable preemption to avoid a race in the cpufreq notifier. (_stp_gettimeofday_ns): Converted from _stp_gettimeofday_us. tapset/ * timestamp.stp (gettimeofday_ns): New function (gettimeofday_us, gettimeofday_ms, gettimeofday_s): Use gettimeofday_ns as the base unit. testsuite/ * buildok/timestamp.stp: add gettimeofday_ns test.
* 2006-07-14 Josh Stone <joshua.i.stone@intel.com>jistone2006-07-141-12/+29
| | | | | | | | | | | | PR 2922 * time.c (_stp_init_time): call cpufreq_get for each cpu from a non-atomic context (module init time). * time.c (__stp_init_time): remove call to cpufreq_get from IPI. * time.c (__stp_time_timer_callback): disable IRQ's to avoid perturbations in measurements. * time.c (_stp_gettimeofday_us): disable preemption to avoid CPU swaps while we're computing the time.
* 2006-06-23 Josh Stone <joshua.i.stone@intel.com>jistone2006-06-231-6/+19
| | | | * time.c: Do cpufreq notification only if CONFIG_CPU_FREQ defined.
* 2006-06-21 Josh Stone <joshua.i.stone@intel.com>jistone2006-06-221-0/+184
runtime/ * time.c: Time-estimation with minimal dependency on xtime. runtime/transport/ * transport/transport.c (_stp_handle_start): Initialize timer functions. * transport.c (_stp_cleanup_and_exit): Teardown timer functions. tapset/ * timestamp.stp (gettimeofday_us, gettimeofday_ms, gettimeofday_s): Convert to using the runtime-provided _stp_gettimeofday_us().