stats.h 1.46 KB
Newer Older
Jack Moffitt's avatar
Jack Moffitt committed
1 2 3
#ifndef __STATS_H__
#define __STATS_H__

Michael Smith's avatar
Michael Smith committed
4 5 6
#include "connection.h"
#include "httpp.h"
#include "client.h"
7 8 9 10
#include <libxml/xmlmemory.h>
#include <libxml/parser.h>
#include <libxml/tree.h>

Michael Smith's avatar
Michael Smith committed
11

Jack Moffitt's avatar
Jack Moffitt committed
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
typedef struct _stats_connection_tag
{
	connection_t *con;
	http_parser_t *parser;
} stats_connection_t;

typedef struct _stats_node_tag
{
	char *name;
	char *value;
} stats_node_t;

typedef struct _stats_event_tag
{
	char *source;
	char *name;
	char *value;

	struct _stats_event_tag *next;
} stats_event_t;

typedef struct _stats_source_tag
{
	char *source;
	avl_tree *stats_tree;
} stats_source_t;

typedef struct _stats_tag
{
	avl_tree *global_tree;

	/* global stats
	start_time
	total_users
	max_users
	total_sources
	max_sources
	total_user_connections
	total_source_connections
	*/

	avl_tree *source_tree;

	/* stats by source, and for stats
	start_time
	total_users
	max_users
	*/

} stats_t;

void stats_initialize();
void stats_shutdown();

stats_t *stats_get_stats();

void stats_event(char *source, char *name, char *value);
void stats_event_args(char *source, char *name, char *format, ...);
void stats_event_inc(char *source, char *name);
void stats_event_add(char *source, char *name, unsigned long value);
void stats_event_dec(char *source, char *name);

void *stats_connection(void *arg);
75
void *stats_callback(void *arg);
Jack Moffitt's avatar
Jack Moffitt committed
76

77
void stats_transform_xslt(client_t *client, char *xslpath);
Jack Moffitt's avatar
Jack Moffitt committed
78
void stats_sendxml(client_t *client);
79
void stats_get_xml(xmlDocPtr *doc);
Jack Moffitt's avatar
Jack Moffitt committed
80 81 82 83 84 85 86

#endif  /* __STATS_H__ */