forked from allinurl/goaccess
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgstorage.h
103 lines (91 loc) · 2.78 KB
/
gstorage.h
1
2
3
4
5
6
7
8
9
10
11
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
/**
* Copyright (C) 2009-2014 by Gerardo Orellana <[email protected]>
* GoAccess - An Ncurses apache weblog analyzer & interactive viewer
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* A copy of the GNU General Public License is attached to this
* source distribution for its full text.
*
* Visit http://goaccess.prosoftcorp.com for new releases.
*/
#ifndef GSTORAGE_H_INCLUDED
#define GSTORAGE_H_INCLUDED
#include "commons.h"
typedef struct GStorageMetrics_
{
/* Maps keys (string) to numeric values (integer).
* This mitigates the issue of having multiple stores
* with the same string key, and therefore, avoids unnecessary
* memory usage (for most cases).
* HEAD|/index.php -> 1
* POST|/index.php -> 2
* POST|Windows XP -> 3
* POST|Ubuntu 10.10 -> 4
* GET|Ubuntu 10.10 -> 5
* Linux -> 6
* 26/Dec/2014 -> 7
* Windows -> 8
*/
void *keymap;
/* Maps numeric keys to actual key values (strings), e.g.,
* 1 -> /index.php
* 2 -> /index.php
* 3 -> Windows XP
* 4 -> Ubuntu 10.10
* 5 -> Ubuntu 10.10
* 7 -> 26/Dec/2014
*/
void *datamap;
/* Maps numeric keys of root elements to actual
* key values (strings), e.g.,
* 6 -> Linux
* 8 -> Windows
*/
void *rootmap;
/* Maps numeric keys to actual key values (strings), e.g.,
* 1 -> 2
* 1 -> 10
*/
void *uniqmap;
/* Key to hits map, e.g.,
* 1 -> hits:10934 , root: -1 ,
* 2 -> hits:3231 , root: -1 ,
* 3 -> hits:500 , root: 8 ,
* 4 -> hits:200 , root: 6 ,
* 5 -> hits:200 , root: 6 ,
* 7 -> 60233
*/
void *hits;
void *visitors;
void *bw;
void *time_served;
void *methods;
void *protocols;
void *agents;
} GStorageMetrics;
typedef struct GStorage_
{
GModule module;
GStorageMetrics *metrics;
} GStorage;
extern GStorage *ht_storage;
GMetrics *new_gmetrics (void);
GStorageMetrics *get_storage_metrics_by_module (GModule module);
GStorageMetrics *new_ht_metrics (void);
GStorage *new_gstorage (uint32_t size);
int *int2ptr (int val);
uint64_t *uint642ptr (uint64_t val);
void *get_storage_metric_by_module (GModule module, GMetric metric);
void *get_storage_metric (GModule module, GMetric metric);
void set_data_metrics (GMetrics * ometrics, GMetrics ** nmetrics,
int processed);
#endif // for #ifndef GSTORAGE_H