usermode/library/mtm/src/stats.c File Reference

Statistics collector implementation. More...

#include <stdbool.h>
#include <string.h>
#include "stats.h"
#include "chhash.h"
#include "util.h"
#include "debug.h"

Go to the source code of this file.

Classes

struct  m_stats_threadstat_s
struct  m_statsmgr_s

Defines

#define M_STATS_THREADSTAT_HASHTABLE_SIZE   128
#define MIN(A, B)   (((A) < (B)) ? (A) : (B))
#define MAX(A, B)   (((A) > (B)) ? (A) : (B))
#define ACTION(name)   #name,
#define WHITESPACE(len)   &__whitespaces[sizeof(__whitespaces) - (len) -1]
#define RESETSTAT(name)

Functions

m_result_t m_statsmgr_create (m_statsmgr_t **statsmgrp, char *output_file)
m_result_t m_statsmgr_destroy (m_statsmgr_t **statsmgrp)
m_result_t m_stats_threadstat_create (m_statsmgr_t *statsmgr, unsigned int tid, m_stats_threadstat_t **threadstatp)
m_result_t m_stats_statset_create (m_stats_statset_t **statsetp)
m_result_t m_stats_statset_destroy (m_stats_statset_t **statsetp)
m_result_t m_stats_statset_init (m_stats_statset_t *statset, const char *name)
void stats_aggregate (m_stats_statset_t *dest_statset, m_stats_statset_t *source_statset)
void m_stats_threadstat_aggregate (m_stats_threadstat_t *threadstat, m_stats_statset_t *source_statset)
void m_stats_print (m_statsmgr_t *statsmgr)
 Prints a statistics report.

Variables

m_statsmgr_tm_g_statsmgr
char * stats_strings []


Detailed Description

Statistics collector implementation.

FIXME: This statistics collector was meant to be as generic as possible but it seems that it didn't live up to its promise. This is because the logic is based on the logic of the statistics collector used in the transaction statistics collector used by MTM. For the future, we would like to implement a more extensible statistics collector similar to the one used by Solaris kstat provider.

Definition in file stats.c.


Define Documentation

#define RESETSTAT ( name   ) 

Value:

statset->stats[m_stats_##name##_stat].total = 0;                    \
  statset->stats[m_stats_##name##_stat].min = 0xFFFFFFFF;             \
  statset->stats[m_stats_##name##_stat].max = 0;


Function Documentation

void m_stats_print ( m_statsmgr_t statsmgr  ) 

Prints a statistics report.

Summarizes statistics and prints a report into the statistics file. Print the statistics report in the same format as the Intel STM's one to avoid duplicating post-processing scripts.

Parameters:
[in] statsmgr Pointer to the statistics manager collecting the statistics.
Returns:
None

Definition at line 415 of file stats.c.

References m_statsmgr_s::alloc_threadstat_list_head, m_stats_statset_s::count, m_chhash_create(), m_chhash_iter_init(), m_chhash_iter_next(), m_stats_statset_init(), M_STATS_THREADSTAT_HASHTABLE_SIZE, m_stats_threadstat_s::next, m_statsmgr_s::output_file, m_stats_statset_s::stats, m_stats_threadstat_s::stats_table, and m_stats_threadstat_s::summary_statset.


Variable Documentation

char* stats_strings[]

Initial value:

 {

}

Definition at line 55 of file stats.c.


Generated on Sat Apr 23 11:43:36 2011 for Mnemosyne by  doxygen 1.4.7