counters/stats: More...
#include "counters.h"#include "str_hash.h"#include "str.h"#include "compiler_opt.h"#include "mem/mem.h"#include "mem/shm_mem.h"
Go to the source code of this file.
Definition in file counters.c.
| static struct counter_record* cnt_hash_add | ( | str * | group, | |
| str * | name, | |||
| int | flags, | |||
| counter_cbk_f | cbk, | |||
| void * | param, | |||
| const char * | doc | |||
| ) | [static, read] |
Definition at line 306 of file counters.c.
References _cnts_vals, cnts_hash_table, grp_hash_get_create(), _str::len, and _str::s.
Referenced by cnt_hash_get_create().


| static struct counter_record* cnt_hash_get_create | ( | str * | group, | |
| str * | name, | |||
| int | flags, | |||
| counter_cbk_f | cbk, | |||
| void * | param, | |||
| const char * | doc | |||
| ) | [static, read] |
Definition at line 450 of file counters.c.
References cnt_hash_add(), and cnt_hash_lookup().
Referenced by counter_register().


| group | - counter group name. If "" the first matching counter with the given name will be returned (k compat). | |
| name |
Definition at line 414 of file counters.c.
References cnts_hash_table, _str::len, and _str::s.
Referenced by cnt_hash_get_create(), counter_lookup_str(), and counter_register().

| char* counter_get_doc | ( | counter_handle_t | handle | ) |
| handle | - counter handle obtained using counter_lookup() or counter_register(). |
Definition at line 721 of file counters.c.
References _cnts_vals.
| char* counter_get_group | ( | counter_handle_t | handle | ) |
| handle | - counter handle obtained using counter_lookup() or counter_register(). |
Definition at line 698 of file counters.c.
References _cnts_vals.
| char* counter_get_name | ( | counter_handle_t | handle | ) |
| handle | - counter handle obtained using counter_lookup() or counter_register(). |
Definition at line 675 of file counters.c.
References _cnts_vals.
| counter_val_t counter_get_raw_val | ( | counter_handle_t | handle | ) |
| handle | - counter handle obtained using counter_lookup() or counter_register(). |
Definition at line 599 of file counters.c.
References _cnts_vals, and counter_pprocess_val.
Referenced by counter_get_val().

| counter_val_t counter_get_val | ( | counter_handle_t | handle | ) |
| handle | - counter handle obtained using counter_lookup() or counter_register(). |
Definition at line 625 of file counters.c.
References _cnts_vals, and counter_get_raw_val().

| void counter_iterate_grp_names | ( | void(*)(void *p, str *grp_name) | cbk, | |
| void * | p | |||
| ) |
| cbk | - pointer to a callback function that will be called for each group name. | |
| p | - parameter that will be passed to the callback function (along the group name). |
Definition at line 745 of file counters.c.
| void counter_iterate_grp_var_names | ( | const char * | group, | |
| void(*)(void *p, str *var_name) | cbk, | |||
| void * | p | |||
| ) |
| group | - group name. | |
| cbk | - pointer to a callback function that will be called for each variable name. | |
| p | - parameter that will be passed to the callback function (along the variable name). |
Definition at line 762 of file counters.c.
References grp_hash_lookup(), _str::len, and _str::s.

| void counter_iterate_grp_vars | ( | const char * | group, | |
| void(*)(void *p, str *g, str *n, counter_handle_t h) | cbk, | |||
| void * | p | |||
| ) |
| group | - group name. | |
| cbk | - pointer to a callback function that will be called for each [variable name, variable handle] pair. | |
| p | - parameter that will be passed to the callback function (along the group name, variable name and variable handle). |
Definition at line 787 of file counters.c.
References grp_hash_lookup(), _str::len, and _str::s.

| int counter_lookup | ( | counter_handle_t * | handle, | |
| const char * | group, | |||
| const char * | name | |||
| ) |
| handle | - filled with the corresp. handle on success. | |
| group | - counter group name. If 0 or "" the first matching counter with the given name will be returned (k compat). | |
| name | - counter name. |
Definition at line 559 of file counters.c.
References counter_lookup_str(), _str::len, and _str::s.

| handle | - filled with the corresp. handle on success. | |
| group | - counter group name. If "" the first matching counter with the given name will be returned (k compat). | |
| name | - counter name. |
Definition at line 536 of file counters.c.
References cnt_hash_lookup().
Referenced by counter_lookup().


| int counter_register | ( | counter_handle_t * | handle, | |
| const char * | group, | |||
| const char * | name, | |||
| int | flags, | |||
| counter_cbk_f | cbk, | |||
| void * | cbk_param, | |||
| const char * | doc, | |||
| int | reg_flags | |||
| ) |
Can be called only before forking (e.g. from mod_init() or init_child(PROC_INIT)).
| handle | - result parameter, it will be filled with the counter handle on success (can be null if not needed). | |
| group | - group name | |
| name | - counter name (group.name must be unique). | |
| flags | - counter flags: one of CNT_F_*. | |
| cbk | - read callback function (if set it will be called each time someone will call counter_get()). | |
| cbk_param | - callback param. | |
| doc | - description/documentation string. | |
| reg_flags | - register flags: 1 - don't fail if counter already registered (act like counter_lookup(handle, group, name). |
Definition at line 483 of file counters.c.
References cnt_hash_get_create(), cnt_hash_lookup(), _str::len, and _str::s.
Referenced by add_script_counter(), and counter_register_array().


| int counter_register_array | ( | const char * | group, | |
| counter_def_t * | defs | |||
| ) |
| group | - counters group. | |
| defs | - null terminated array containing counters definitions. |
Definition at line 579 of file counters.c.
References counter_register().

| void counter_reset | ( | counter_handle_t | handle | ) |
Reset a counter, unless it has the CNT_F_NO_RESET flag set.
| handle | - counter handle obtained using counter_lookup() or counter_register(). Note: it's racy. |
Definition at line 648 of file counters.c.
References _cnts_vals, and counter_pprocess_val.
| int counters_prefork_init | ( | int | max_process_no | ) |
shm must be available.
Definition at line 187 of file counters.c.
References _cnts_vals, counter_pprocess_val, and process_no.
| static struct grp_record* grp_hash_add | ( | str * | group | ) | [static, read] |
Definition at line 225 of file counters.c.
References grp_hash_table, _str::len, and _str::s.
Referenced by grp_hash_get_create().

| static struct grp_record* grp_hash_get_create | ( | str * | group | ) | [static, read] |
Definition at line 291 of file counters.c.
References grp_hash_add(), and grp_hash_lookup().
Referenced by cnt_hash_add().


| static struct grp_record* grp_hash_lookup | ( | str * | group | ) | [static, read] |
Definition at line 278 of file counters.c.
References grp_hash_table, _str::len, and _str::s.
Referenced by counter_iterate_grp_var_names(), counter_iterate_grp_vars(), and grp_hash_get_create().

| int init_counters | ( | void | ) |
Definition at line 102 of file counters.c.
References cnts_hash_table, and grp_hash_table.
| counter_array_t* _cnts_vals |
a[proc_no][counter_id] => _cnst_vals[proc_no*cnts_no+counter_id]
Definition at line 92 of file counters.c.
Referenced by cnt_hash_add(), counter_get_doc(), counter_get_group(), counter_get_name(), counter_get_raw_val(), counter_get_val(), counter_reset(), and counters_prefork_init().
1.7.1