summaryrefslogtreecommitdiffstats
path: root/runtime/map.c
Commit message (Collapse)AuthorAgeFilesLines
* cleanup: explain -5 magic value used in map-sorting codeFrank Ch. Eigler2009-11-201-1/+1
|
* Initialize aptr in runtime/map.c and keep gcc-4.4 happyAnanth N Mavinakayanahalli2009-05-131-1/+1
|
* PR10001: Use the kernel's strlcpy & strlcatJosh Stone2009-03-261-16/+5
| | | | | | We had our own implementations of these which were triggering gcc bug38480 in some particular cases. It's easier for us to use the kernel's strlcpy and strlcat anyway, which avoids the bug.
* Removed unused functions and variables.David Smith2009-02-181-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2009-02-18 David Smith <dsmith@redhat.com> * io.c (_stp_log): Removed unused function. * map.c (_stp_cmp): Replace _stp_log() with dbug(). * mempool.c (_stp_mempool_resize): Removed unused function. * print.c (next_fmt): Removed unused function. * procfs.c: Removed unused variable '_stp_num_procfs_files'. * regs.c (_stp_ret_addr): Removed unused function. * string.c (_stp_text_str): Removed unused variable 'len'. * string.h: Removed unused variable '_stdout_' and function declaration for deleted function '_stp_vsprintf'. * sym.c: Removed unused variables. * unwind.c (_stp_create_unwind_hdr): Removed unused function. 2009-02-18 David Smith <dsmith@redhat.com> * control.c: Removed unused variable '_stp_current_buffers'. * procfs.c (_stp_set_buffers): Removed unused function. (_stp_register_ctl_channel_fs): Removed unused variables and label. * symbols.c (u32_swap): Removed unused function. (generic_swap): Ditto. (_stp_sort): Ditto. (_stp_section_is_interesting): Ditto. * transport.c (_stp_transport_init): Removed unused variable 'ret'.
* Use 'static' as much as possibleJosh Stone2009-01-281-21/+21
| | | | | | | | | | 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.
* Fix the conflicted for_each_cpu macro with 2.6.28.Wenji Huang2008-11-171-7/+7
|
* SW5106 Remove old map and histogram formatting codeStan Cox2008-05-291-127/+3
|
* rebased unwind_branch on top of current masterFrank Ch. Eigler2008-03-251-1/+0
|
* 2008-02-27 Martin Hunt <hunt@redhat.com>hunt2008-02-271-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | * sym.h (_stp_module): Add text_size, lock, and unwind data pointer. * sym.c (_stp_find_module_by_addr): New function. (_stp_kallsyms_lookup): Call _stp_find_module_by_addr(). (_stp_get_unwind_info): New. * runtime.h: Move debug macros to debug.h. Include it. * debug.h: New file. * map.c: Update debug calls. * map-gen.c: Update debug calls. * pmap-gen.c: Update debug calls. * mempool.c: New file. * symbols.c: Use rwlocks. Use new dbug macros. Handle unwind info if present. * transport.c: Include mempool.c. Update dbug and kbug calls to new macros. * transport_msgs.h (_stp_command_name): Add struct containing message names for debugging. * control.c, procfs.c: Use new dbug macros. Use new mempool functions.
* Add support for memory allocation tracking.hunt2008-01-151-16/+10
|
* 2007-05-29 Frank Ch. Eigler <fche@redhat.com>fche2007-05-291-0/+10
| | | | | | | | PR 2224 * map.h (NEED_MAP_LOCKS): New config macro, defaults to 0. (MAP_GET_CPU, MAP_PUT_CPU): Wrappers, default to ~no-op. * map.c (_stp_pmap_clear,agg): Use them. * pmap-gen.c (_stp_pmap_new,set,add,get_cpu,get,del): Ditto.
* 2007-03-21 Martin Hunt <hunt@redhat.com>hunt2007-03-211-1/+1
| | | | * map.c (_stp_map_init): Fix signed vs unsigned comparison warning.
* 2007-03-14 Martin Hunt <hunt@redhat.com>hunt2007-03-141-1/+1
| | | | | | | | | | | | | | | | | | | | * bench2/bench.rb: Updated to work with new transport and new itest.c. * bench2/Makefile: Updated for new itest.c * bench2/itest.c: Rewritten to use multiple threads and automatically divide the workload among the threads. * print.c (_stp_print_flush): Move to print_new.c and print_old.c. * print_new.c: New file containing _stp_print_flush() for the new transport. * print_old.c: Ditto for old transport. * runtime.h (STP_OLD_TRANSPORT): Define (errk): Define. (MAXSTRINGLEN): Define if not already defined. * io.c (_stp_vlog): Use _stp_ctl_write().
* 2007-01-31 Martin Hunt <hunt@redhat.com>hunt2007-01-311-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * string.c (_stp_string_init): Deleted. (_stp_sprintf): Deleted. (_stp_vsprintf): Deleted. (_stp_string_cat_cstr): Deleted. (_stp_string_cat_string): Deleted. (_stp_string_cat_char): Deleted. (_stp_string_ptr): Deleted. (_stp_string_cat): Deleted. (_stp_snprintf): Moved from vsprintf.c. (_stp_vscnprintf): Moved from vsprintf.c. * string.h (STP_STRING_SIZE): Deleted. (STP_NUM_STRINGS): Deleted. Remove all references to type "String". * vsprintf.c (_stp_vscnprintf): Moved to string.c. (_stp_snprintf): Moved to string.c * sym.c (_stp_symbol_sprint): Replaced with _stp_symbol_print, which writes to the print buffer. (_stp_symbol_sprint_basic): Replaced with _stp_symbol_snprint. * runtime.h: Include io.c. * stat-common.c: Use new _stp_print* functions. * stat.c: Ditto. * regs.c: Renamed to regs-ia64.c. * current.c: Renamed regs.c. * regs-ia64.c: New file (renamed from regs.c). * stack.c (_stp_stack_sprint): Renamed _stp_stack_print and now just prints to the print buffer. Calls __stp_stack_print instead of __stp_stack_sprint. (_stp_stack_snprint): New function. Calls _stp_stack_print and then copies the print buffer into a string. (_stp_stack_printj): Deleted. (_stp_ustack_sprint): Deleted. * stack-*.c: Rewritten to print instead of writing to strings. Uses new _stp_print* functions. * print.c (_stp_printf): Create new function instead of macro. (_stp_print): Ditto. (_stp_print_char): New function. * map.c: Use _stp_print() and _stp_print_char() instead of _stp_print_cstr(). * io.c (_stp_vlog): Use _stp_print() instead of _stp_string_cat_cstr(). * copy.c (_stp_string_from_user): Deleted.
* 2007-01-30 Martin Hunt <hunt@redhat.com>hunt2007-01-301-1/+1
| | | | | | | | | | | * alloc.c (_stp_alloc_percpu): Don't implement our own; just call __alloc_percpu with appropriate args for the OS version. (_stp_free_percpu): Delete. * map.c (_stp_map_init): When calling kmalloc_node, first call cpu_to_node() to get the proper node number. * stat.c (_stp_stat_del): Call free_percpu() instead of _stp_free_percpu().
* 2007-01-29 Martin Hunt <hunt@redhat.com>hunt2007-01-291-5/+9
| | | | | | | | | | * 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.
* 2007-01-10 Martin Hunt <hunt@redhat.com>hunt2007-01-101-16/+17
| | | | | | | | | | | | | | | PR 3708 * map.c (str_copy): Check for NULL pointers. (_new_map_set_int64): Don't check val for 0. (_new_map_set_str): Don't check val for NULL. * map-gen.c (VAL_IS_ZERO): Removed. (_stp_map_del): New. (__stp_map_set): Don't check for zero. * pmap-gen.c (VAL_IS_ZERO): Removed. (_stp_pmap_del): New. (__stp_pmap_set): Don't check for zero.
* 2006-11-15 Martin Hunt <hunt@redhat.com>hunt2006-11-151-10/+8
| | | | | | | * alloc.c (STP_ALLOC_FLAGS): Define. Cleanup ifdefs. * map.c: Use STP_ALLOC_FLAGS. * stat.c: ditto.
* 2006-03-30 Martin Hunt <hunt@redhat.com>hunt2006-03-301-2/+2
| | | | * string.c (_stp_string_cat_cstr): Use memcpy() instead of strncpy().
* 2006-01-16 Martin Hunt <hunt@redhat.com>hunt2006-01-161-3/+7
| | | | | * map.c (_stp_pmap_agg): Return NULL when aggregation fails.
* 2005-12-14 Martin Hunt <hunt@redhat.com>hunt2005-12-141-0/+17
| | | | | | | | | | | | | * pmap-gen.c (_stp_pmap_new_*): Initialize lock. (_stp_pmap_set_*): Lock map while in use. (_stp_pmap_add_*): Lock map while in use. (_stp_pmap_get_cpu): Ditto. (_stp_pmap_get): Lock each per-cpu map. * map-gen.c: Define and use NULLRET for a NULL return value. * map.c (_stp_pmap_clear): New function. (_stp_pmap_agg): Lock each per-cpu map as it gets aggregated.
* 2005-12-13 Martin Hunt <hunt@redhat.com>hunt2005-12-131-1/+1
| | | | | * map.c (_stp_map_sortn): Set a limit of 30 for n. Automatically call _stp_map_sort() if more is requested.
* 2005-12-08 Martin Hunt <hunt@redhat.com>hunt2005-12-081-2/+27
| | | | | | | * map.c (_new_map_create): Only increment map size if a node was moved off the free list. (_stp_map_size): New function. (_stp_pmap_size): New function.
* 2005-12-07 Martin Hunt <hunt@redhat.com>hunt2005-12-071-61/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | PR1923 * map.h (struct map_root): Remove membuf. (struct pmap): Define. (PMAP): Declare. * map.c (_stp_map_init): Use kmalloc() to allocate individual nodes instead of using vmalloc() to allocate one big chunk. (_stp_map_new): Use kmalloc. (_stp_pmap_new): Use kmalloc. Return a PMAP. (__stp_map_del): New function. Free all the nodes in a map. (_stp_map_del): Call __stp_map_del() then free map struct. (_stp_pmap_del): Takes a PMAP. Calls __stp_map_del() for each cpu. (_stp_pmap_printn_cpu): Change arg to PMAP. (_stp_pmap_agg): Change arg to PMAP. (_stp_pmap_get_agg): Change arg to PMAP. * map-stat.c (_stp_pmap_new_hstat_linear): Use PMAP instead of MAP. Fix allocations. (_stp_pmap_new_hstat_log): Ditto. * pmap-gen.c Fix all functions to take or return PMAPS instead of MAPS. * alloc.c: Remove everything except kmalloc_node(). All runtime code now uses kmalloc() directly.
* 2005-11-28 Martin Hunt <hunt@redhat.com>hunt2005-11-281-4/+4
| | | | | | | | | | | * alloc.c (__stp_valloc_percpu): Use same code for up and smp. (_stp_per_cpu_ptr): New macro. * user/alloc.c: Ditto. * map.c: Use _stp_map_cpu_ptr(). * map-stat.c: Ditto. * pmap-gen.c: Ditto. * runtime.h: Include alloc.c * user/runtime.h: Ditto.
* 2005-11-28 Martin Hunt <hunt@redhat.com>hunt2005-11-281-1/+1
| | | | | * map.c (_stp_pmap_del): Use _stp_free_percpu() to free pmaps.
* 2005-11-10 Martin Hunt <hunt@redhat.com>hunt2005-11-111-8/+14
| | | | | | | | | * pmap-gen.c (_stp_pmap_get()): New function. Aggregates the per-cpu map nodes into an aggregation map node. * map.c (_stp_new_agg): Return a struct map_node *. (_stp_add_agg): If count is 0 when adding, just set the stats.
* 2005-11-10 Martin Hunt <hunt@redhat.com>hunt2005-11-101-11/+21
| | | | | | * map.c: Doc updates. * pmap-gen.c: Change a bunch of generated function names to avoid conflicts with maps with the same key and value types.
* 2005-11-10 Martin Hunt <hunt@redhat.com>hunt2005-11-101-2/+2
| | | | * map.c (_stp_cmp): Use _stp_div64().
* 2005-11-09 Martin Hunt <hunt@redhat.com>hunt2005-11-091-3/+42
| | | | | | * map.c (_stp_cmp): Patch to sort on stats. (_stp_map_sort): Ditto. (_stp_map_sortn): Ditto.
* 2005-11-09 Martin Hunt <hunt@redhat.com>hunt2005-11-091-2/+2
| | | | * map.c: Change order of includes.
* 2005-11-09 Martin Hunt <hunt@redhat.com>hunt2005-11-091-120/+15
| | | | | | | | | | | | | | | * map.h (struct map_root): Delete fields used by old API. * map.c: Remove old map API functions. * map-stat.c (_stp_map_add_stat): Delete. (_stp_pmap_new_hstat_linear): Move here from map.c. (_stp_pmap_new_hstat_log): Ditto. * list.c: Deleted. * map-keys.c: Deleted. * map-values.c: Deleted. * map-int.c: Deleted.
* 2005-11-08 Martin Hunt <hunt@redhat.com>hunt2005-11-081-39/+313
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * map.c (_stp_map_init): New function. Extracted from _stp_map_new() so it can be used in _stp_pmap_new(). (_stp_map_new): Call _stp_map_init(). (_stp_pmap_new): New function. (_stp_pmap_new_hstat_linear): New function. (_stp_pmap_new_hstat_log): New function. (_stp_pmap_del): New function. (_stp_pmap_printn_cpu): New function. (_stp_pmap_printn): New function. (_stp_new_agg): New function. (_stp_add_agg): New function. (_stp_pmap_agg): New function. (_new_map_clear_node): New function. * map.h (struct map_root): Add Hist struct. Add copy and cmp function pointers for pmaps. * stat.h: Remove Stat struct. Replace with Hist struct that is limited to only histogram params. * map-stat.c: Fix up references to histogram params in map_root. * stat-common.c: Ditto. * stat.c: Ditto. * pmap-gen.c: New file. Implements per-cpu maps. * map-gen.c: Minor bug fixes. Use new VAL_IS_ZERO() macro. * alloc.c (vmalloc_node): For NUMA, provide a vmalloc that does node-local allocations. (_stp_alloc_cpu): A version of _stp_alloc() that does node-local allocations. (_stp_valloc): A version of _stp_valloc() that does node-local allocations. (__stp_valloc_percpu): New function. Like alloc_percpu() except uses _stp_valloc(). (_stp_vfree_percpu): New function. Like free_percpu().
* 2005-10-31 Martin Hunt <hunt@redhat.com>hunt2005-10-311-1/+11
| | | | * ALL: Cleanup copyrights.
* 2005-10-28 Martin Hunt <hunt@redhat.com>hunt2005-10-281-28/+27
| | | | | | | | | | | | | | | | | | * map-gen.c (MAP_GET_VAL): Use the _stp_get_*() functions. (_stp_map_set_*): When setting to "", don't create node if key not found. (_stp_map_get_*): Use new MAP_GET_VAL. Return "" when string lookups not found. * map.c (_stp_get_int64): Check args and return 0 on bad args or wrong type. (_stp_get_stat): Ditto. (_stp_key_get_int64): Ditto. (_stp_get_str): Check args and return "bad type" on bad args or wrong type. (_stp_key_get_str): Ditto. (_new_map_set_str): If setting to "", delete node. (_new_map_get_*): Delete. Use _stp_get_*().
* 2005-10-26 Martin Hunt <hunt@redhat.com>hunt2005-10-261-14/+131
| | | | | | | | | | | | | | | | | | * map.c (_new_map_create, _new_map_del_node, _new_map_del_node, _new_map_set_int64, _new_map_set_str,_new_map_get_int64, _new_map_get_str, _new_map_get_stat, _new_map_set_stat): New internal functions for the new API. * map-int.c (__stp_map_set_int64): Modify to return an error code. * map-stat.c (_stp_map_add_stat): Ditto. * map-str (_stp_map_set_str): Ditto. * Doxyfile: Remove predefines NEED_STRING_VALS, NEED_STATS, NEED_INT64. * map-keys.c: Ditto. * list.c (_stp_list_new): Ditto. Also set map->list. * map-values.c: Ditto.
* 2005-09-23 Martin Hunt <hunt@redhat.com>hunt2005-09-231-59/+63
| | | | | * map.c (_stp_map_sortn): Call _stp_map_sort() when n is 0.
* 2005-09-23 Martin Hunt <hunt@redhat.com>hunt2005-09-231-1/+180
| | | | | | | | | * map.c (_stp_cmp): New comparison function for sorts. (_stp_swap): New swap function for bubble sort. (_stp_map_sortn): New function. (_stp_map_sort): New function. (_stp_map_printn): New function. (_stp_map_print): Convert to a macro.
* 2005-09-14 Martin Hunt <hunt@redhat.com>hunt2005-09-141-0/+29
| | | | | * map.c (_stp_map_clear): New function. CLears a map but does not free it.
* 2005-07-01 Martin Hunt <hunt@redhat.com>hunt2005-07-011-11/+8
| | | | | | | | | | | | | | * map.c (_stp_map_new): Call _stp_error() on a bad map type. Comment out dbug()s. * map-stat.c (_stp_map_new_hstat_log): Call _stp_warn(). (_stp_map_new_hstat_linear): Ditto. * map-int.c: Comment out dbug()s. * map-str.c: Comment out dbug()s. * map-keys.c: Use _stp_warn(). Comment out dbug()s.
* 2005-06-29 Martin Hunt <hunt@redhat.com>hunt2005-06-291-2/+2
| | | | | | | * map-values.c (_stp_map_add_int64): Fix docs. * map-str.c: Fix some docs * map.c: Ditto. * map.doc: Ditto.
* 2005-06-18 Martin Hunt <hunt@redhat.com>hunt2005-06-181-367/+62
| | | | | | | | | | | | | | | | | | | | | | | * counter.c: New file. Counter aggregations. * stat.c: New file. Stat aggregations. * stat.h: Header file for stats. * map-int.c: New file. Support for int64 values. * map-stat.c: New file. Support for stat values. * map-str.c: New file. Support for string values. * map-values.c: Now just includes the necessary map-*.c files. * stat-common.c: New file. Stats stuff common to Stats and maps containing stats. * Doxyfile: Bumped version to 0.6. * README: Renamed README.doc and reorganized.
* 2005-05-31 Martin Hunt <hunt@redhat.com>hunt2005-05-311-34/+160
| | | | | | | | | * map.c (_stp_map_print): Now takes a format string instead of a name. * map.h (foreach): Update macro. * string.c (_stp_string_cat_char): New function. Append a char to a string.
* 2005-05-17 Martin Hunt <hunt@redhat.com>hunt2005-05-181-5/+14
| | | | | | | | | | | | * map.c (needed_space): Use do_div(). (_stp_map_print_histogram): Ditto. (_stp_map_print): Ditto. * map-values.c (_stp_map_add_int64_stat): Use do_div() when computing histogram bucket. * map-keys.c (_stp_map_key): Fix some warnings on 32-bit machines by using key_data casts.
* Rewritten maps and other updated files.hunt2005-05-171-708/+385
|
* *** empty log message ***hunt2005-04-071-5/+25
|
* Update to use relayfs.hunt2005-04-071-1/+13
|
* *** empty log message ***hunt2005-03-291-0/+21
|
* *** empty log message ***hunt2005-03-221-1/+0
|
* *** empty log message ***hunt2005-03-221-4/+11
|