-
Notifications
You must be signed in to change notification settings - Fork 108
/
Copy pathcharts.h
679 lines (644 loc) · 19 KB
/
charts.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
#ifndef CHARTS_H
#define CHARTS_H
#include <string>
#include <vector>
#include <queue>
#include <map>
#include "config.h"
#include "sql_db.h"
#include "calltable.h"
#include "tools_global.h"
using namespace std;
enum eChartType {
_chartType_na = 0,
_chartType_total = 1,
_chartType_count,
_chartType_cps,
_chartType_minutes,
_chartType_count_perc_short,
_chartType_response_time_100,
_chartType_mos,
_chartType_mos_caller,
_chartType_mos_called,
_chartType_mos_xr_avg,
_chartType_mos_xr_avg_caller,
_chartType_mos_xr_avg_called,
_chartType_mos_xr_min,
_chartType_mos_xr_min_caller,
_chartType_mos_xr_min_called,
_chartType_mos_silence_avg,
_chartType_mos_silence_avg_caller,
_chartType_mos_silence_avg_called,
_chartType_mos_silence_min,
_chartType_mos_silence_min_caller,
_chartType_mos_silence_min_called,
_chartType_mos_lqo_caller,
_chartType_mos_lqo_called,
_chartType_packet_lost,
_chartType_packet_lost_caller,
_chartType_packet_lost_called,
_chartType_jitter,
_chartType_jitter_caller,
_chartType_jitter_called,
_chartType_delay,
_chartType_delay_caller,
_chartType_delay_called,
_chartType_rtcp_avgjitter,
_chartType_rtcp_maxjitter,
_chartType_rtcp_avgfr,
_chartType_rtcp_maxfr,
_chartType_rtcp_avgrtd,
_chartType_rtcp_maxrtd,
_chartType_rtcp_avgrtd_w,
_chartType_rtcp_maxrtd_w,
_chartType_silence,
_chartType_silence_caller,
_chartType_silence_called,
_chartType_silence_end,
_chartType_silence_end_caller,
_chartType_silence_end_called,
_chartType_clipping,
_chartType_clipping_caller,
_chartType_clipping_called,
_chartType_pdd,
_chartType_acd_avg,
_chartType_acd,
_chartType_asr_avg,
_chartType_asr,
_chartType_ner_avg,
_chartType_ner,
_chartType_seer_avg,
_chartType_seer,
_chartType_sipResp,
_chartType_sipResponse,
_chartType_sipResponse_base,
_chartType_codecs,
_chartType_IP_src,
_chartType_IP_dst,
_chartType_domain_src,
_chartType_domain_dst,
_chartType_caller_countries,
_chartType_called_countries,
_chartType_SIP_src_IP_countries,
_chartType_SIP_dst_IP_countries,
_chartType_price_customer,
_chartType_price_operator
};
enum eChartSubType {
_chartSubType_na = 0,
_chartSubType_count = 1,
_chartSubType_value = 2,
_chartSubType_acd_asr = 3,
_chartSubType_area = 4,
_chartSubType_perc = 5
};
enum eChartValueType {
_chartValueType_na,
_chartValueType_cnt,
_chartValueType_sum,
_chartValueType_min,
_chartValueType_max,
_chartValueType_avg,
_chartValueType_perc95,
_chartValueType_perc99
};
enum eChartPercType {
_chartPercType_NA,
_chartPercType_Asc,
_chartPercType_Desc
};
enum eChartTypeUse {
_chartTypeUse_NA,
_chartTypeUse_chartCache,
_chartTypeUse_cdrStat
};
enum eCdrStatType {
_cdrStatType_NA,
_cdrStatType_total = 1,
_cdrStatType_count,
_cdrStatType_cps,
_cdrStatType_minutes,
_cdrStatType_asr = 11,
_cdrStatType_acd,
_cdrStatType_ner,
_cdrStatType_seer,
_cdrStatType_mos = 21,
_cdrStatType_packet_loss,
_cdrStatType_jitter,
_cdrStatType_delay,
_cdrStatType_price_customer = 31,
_cdrStatType_price_operator
};
struct sChartTypeDef {
u_int16_t chartType;
u_int8_t pool;
u_int8_t enableZero;
eChartPercType percType;
u_int8_t condEqLeft;
eChartSubType subType;
};
class cChartDataItem {
public:
cChartDataItem();
void add(sChartsCallData *call, unsigned call_interval, bool firstInterval, bool lastInterval, bool beginInInterval,
class cChartSeries *series, class cChartIntervalSeriesData *intervalSeries,
u_int32_t calldate_from, u_int32_t calldate_to);
string json(class cChartSeries *series);
double getValue(class cChartSeries *series, eChartValueType typeValue = _chartValueType_na, bool *null = NULL);
private:
double getPerc(unsigned perc, eChartPercType type, unsigned values_size = 0);
private:
volatile double max;
volatile double min;
volatile double sum;
map<float, unsigned> values;
volatile unsigned int count;
volatile unsigned int count2;
map<unsigned int, unsigned int> count_intervals;
volatile unsigned int countAll;
volatile unsigned int countConected;
volatile unsigned int sumDuration;
volatile unsigned int countShort;
};
class cChartDataMultiseriesItem {
public:
cChartDataMultiseriesItem();
~cChartDataMultiseriesItem();
string json(class cChartSeries *series, class cChartIntervalSeriesData *intervalSeries);
private:
map<int, cChartDataItem*> data;
friend class cChartIntervalSeriesData;
};
class cChartDataPool {
private:
class cPool {
public:
cPool(u_int32_t timeFrom, u_int32_t timeTo) {
size_m = (timeTo - timeFrom) / 60 + 1;
pool = new FILE_LINE(0) u_int32_t*[size_m];
for(unsigned i = 0; i < size_m; i++) {
pool[i] = NULL;
}
}
~cPool() {
for(unsigned i = 0; i < size_m; i++) {
if(pool[i]) {
delete pool[i];
}
}
delete pool;
}
void inc(u_int32_t time_s) {
u_int32_t time_m = time_s / 60;
if(time_m >= size_m) {
return;
}
time_s = time_s % 60;
if(!pool[time_m]) {
pool[time_m] = new FILE_LINE(0) u_int32_t[60];
memset((void*)pool[time_m], 0, 60 * sizeof(u_int32_t));
}
++pool[time_m][time_s];
}
u_int32_t operator [] (u_int32_t time_s) {
u_int32_t time_m = time_s / 60;
if(time_m >= size_m) {
return(0);
}
time_s = time_s % 60;
if(!pool[time_m]) {
return(0);
}
return(pool[time_m][time_s]);
}
private:
u_int32_t size_m;
u_int32_t **pool;
};
public:
cChartDataPool();
~cChartDataPool();
void createPool(u_int32_t timeFrom, u_int32_t timeTo);
void initPoolRslt();
void add(sChartsCallData *call, unsigned call_interval, bool firstInterval, bool lastInterval, bool beginInInterval,
class cChartSeries *series, class cChartInterval *interval,
u_int32_t calldate_from, u_int32_t calldate_to);
string json(class cChartSeries *series, class cChartInterval *interval);
double getValue(class cChartSeries *series, class cChartInterval *interval, eChartValueType typeValue = _chartValueType_na, bool *null = NULL);
private:
volatile unsigned int all;
map<unsigned int, unsigned int> all_intervals;
volatile unsigned int all_fi;
volatile unsigned int all_li;
cPool *pool;
};
class cChartIntervalSeriesData {
public:
cChartIntervalSeriesData(eChartTypeUse typeUse, class cChartSeries *series = NULL, class cChartInterval *interval = NULL);
~cChartIntervalSeriesData();
void prepareData();
void add(sChartsCallData *call, unsigned call_interval, bool firstInterval, bool lastInterval, bool beginInInterval,
u_int32_t calldate_from, u_int32_t calldate_to);
double getValue(eChartValueType typeValue = _chartValueType_na, bool *null = NULL);
string getChartData(class cChartInterval *interval);
void store(class cChartInterval *interval, vmIP *ip, SqlDb *sqlDb, int src_dst);
void lock_data() { __SYNC_LOCK(sync_data); }
void unlock_data() { __SYNC_UNLOCK(sync_data); }
private:
eChartTypeUse typeUse;
class cChartSeries *series;
class cChartInterval *interval;
cChartDataItem *dataItem;
cChartDataPool *dataPool;
cChartDataMultiseriesItem *dataMultiseriesItem;
vector<string> param;
map<string_icase, int> param_map;
volatile int sync_data;
string last_chart_data;
u_int32_t created_at_s;
u_int32_t store_counter;
volatile u_int32_t counter_add;
friend class cChartDataItem;
friend class cChartDataMultiseriesItem;
friend class cChartInterval;
};
class cChartSeriesId {
public:
cChartSeriesId(unsigned int id, const char *config_id) {
this->id = id;
this->config_id = config_id;
};
friend inline const bool operator == (const cChartSeriesId &id1, const cChartSeriesId &id2) {
return(id1.id == id2.id &&
id1.config_id == id2.config_id);
}
friend inline const bool operator < (const cChartSeriesId &id1, const cChartSeriesId &id2) {
return(id1.id < id2.id ? 1 : id1.id > id2.id ? 0 :
id1.config_id < id2.config_id);
}
private:
unsigned int id;
string config_id;
friend class cChartInterval;
friend class cChartIntervalSeriesData;
};
class cChartInterval {
public:
struct sSeriesDataCdrStat {
sSeriesDataCdrStat() {
count = 0;
count_connected = 0;
for(unsigned i = 0; i < sizeof(count_lsr_3_6) / sizeof(count_lsr_3_6[0]); i++) {
count_lsr_3_6[i] = 0;
}
store_counter = 0;
counter_add = 0;
}
unsigned count;
unsigned count_connected;
unsigned count_lsr_3_6[4];
map<u_int16_t, cChartIntervalSeriesData*> data;
u_int32_t store_counter;
volatile u_int32_t counter_add;
};
struct sFieldValue {
string field;
double value;
bool null;
};
public:
cChartInterval(eChartTypeUse typeUse);
~cChartInterval();
void setInterval(u_int32_t timeFrom, u_int32_t timeTo);
void setInterval(u_int32_t timeFrom, u_int32_t timeTo, vmIP &ip_src, vmIP &ip_dst);
void add(sChartsCallData *call, unsigned call_interval, bool firstInterval, bool lastInterval, bool beginInInterval,
u_int32_t calldate_from, u_int32_t calldate_to,
map<class cChartFilter*, bool> *filters_map);
void add(sChartsCallData *call, unsigned call_interval, bool firstInterval, bool lastInterval, bool beginInInterval,
u_int32_t calldate_from, u_int32_t calldate_to,
vmIP &ip_src, vmIP &ip_dst);
void store(u_int32_t act_time, u_int32_t real_time, SqlDb *sqlDb);
void init();
void init(vmIP &ip_src, vmIP &ip_dst);
void clear();
private:
eChartTypeUse typeUse;
u_int32_t timeFrom;
u_int32_t timeTo;
map<cChartSeriesId, cChartIntervalSeriesData*> seriesData;
map<vmIP, sSeriesDataCdrStat*> seriesDataCdrStat_src;
map<vmIP, sSeriesDataCdrStat*> seriesDataCdrStat_dst;
u_int32_t created_at_real;
u_int32_t last_use_at_real;
u_int32_t last_store_at;
u_int32_t last_store_at_real;
volatile u_int32_t counter_add;
friend class cChartDataPool;
friend class cChartIntervalSeriesData;
friend class cCharts;
friend class cCdrStat;
};
class cChartFilter {
public:
cChartFilter(const char *filter, const char *filter_only_sip_ip, const char *filter_without_sip_ip);
~cChartFilter();
bool check(sChartsCallData *call, void *callData, bool ip_comb_v6, void *ip_comb, class cFiltersCache *filtersCache, int threadIndex);
private:
string filter;
string filter_only_sip_ip;
string filter_without_sip_ip;
cEvalFormula::sSplitOperands **filter_s;
cEvalFormula::sSplitOperands **filter_only_sip_ip_s;
cEvalFormula::sSplitOperands **filter_without_sip_ip_s;
bool ip_filter_contain_sipcallerip;
bool ip_filter_contain_sipcalledip;
volatile int used_counter;
friend class cChartSeries;
friend class cCharts;
friend class cCdrStat;
};
class cChartLsrFilter {
private:
struct sFilterItem {
sFilterItem(unsigned lsr) {
this->lsr = lsr;
}
bool check(unsigned lsr) {
while(log10(lsr) > log10(this->lsr)) {
lsr = lsr / 10;
}
return(lsr == this->lsr);
}
unsigned lsr;
};
public:
void parseData(JsonItem *jsonData);
bool check(unsigned lsr) {
if(b.size()) {
for(unsigned i = 0; i < b.size(); i++) {
if(b[i].check(lsr)) {
return(false);
}
}
}
if(w.size()) {
for(unsigned i = 0; i < w.size(); i++) {
if(w[i].check(lsr)) {
return(true);
}
}
}
return(false);
}
private:
vector<sFilterItem> w;
vector<sFilterItem> b;
};
class cChartSeries {
public:
cChartSeries(unsigned int id, const char *config_id, const char *config, class cCharts *charts);
cChartSeries(eCdrStatType cdrStatType, const char *chart_type, const char *source_data_name = NULL);
~cChartSeries();
void clear();
bool isIntervals() {
return(intervals.size() > 0);
}
bool isArea() {
return(def.subType == _chartSubType_area);
}
bool checkFilters(map<class cChartFilter*, bool> *filters_map);
private:
eChartTypeUse typeUse;
cChartSeriesId series_id;
string type_source;
string chartType;
string sourceDataName;
vector<double> intervals;
vector<string> param;
map<string_icase, int> param_map;
vector<cChartFilter*> filters;
cChartLsrFilter *ner_lsr_filter;
cChartLsrFilter *seer_lsr_filter[2];
sChartTypeDef def;
volatile int used_counter;
volatile int terminating;
friend class cChartDataItem;
friend class cChartDataPool;
friend class cChartIntervalSeriesData;
friend class cChartInterval;
friend class cCharts;
friend class cCdrStat;
};
class cCharts {
public:
cCharts();
~cCharts();
void load(SqlDb *sqlDb);
void reload();
void initIntervals();
void clear();
cChartFilter* getFilter(const char *filter, bool enableAdd,
const char *filter_only_sip_ip, const char *filter_without_sip_ip);
cChartFilter* addFilter(const char *filter, const char *filter_only_sip_ip, const char *filter_without_sip_ip);
void add(sChartsCallData *call, void *callData, class cFiltersCache *filtersCache, int threadIndex);
void checkFilters(sChartsCallData *call, void *callData, map<cChartFilter*, bool> *filters, class cFiltersCache *filtersCache, int threadIndex);
void store(bool forceAll = false);
void cleanup(bool forceAll = false);
bool seriesIsUsed(cChartSeriesId series_id);
void lock_intervals() { __SYNC_LOCK(sync_intervals); }
void unlock_intervals() { __SYNC_UNLOCK(sync_intervals); }
private:
map<cChartSeriesId, cChartSeries*> series;
map<u_int32_t, cChartInterval*> intervals;
map<string, cChartFilter*> filters;
volatile u_int32_t first_interval;
unsigned maxValuesPartsForPercentile;
unsigned maxLengthSipResponseText;
unsigned intervalStore;
unsigned intervalCleanup;
unsigned intervalExpiration;
unsigned intervalReload;
SqlDb *sqlDbStore;
u_int32_t last_store_at;
u_int32_t last_store_at_real;
u_int32_t last_cleanup_at;
u_int32_t last_cleanup_at_real;
u_int32_t last_reload_at;
u_int32_t last_reload_at_real;
volatile int sync_intervals;
friend class cChartDataItem;
friend class cChartInterval;
friend class Call;
};
class cCdrStat {
public:
enum eTypeStore {
_typeStore_na = 0,
_typeStore_values = 1,
_typeStore_sources = 2,
_typeStore_all = 4
};
struct sMetrics {
sMetrics(const char *field, eCdrStatType type_stat, eChartValueType type_value) {
this->field = field;
this->type_stat = type_stat;
this->type_value = type_value;
}
string field;
eCdrStatType type_stat;
eChartValueType type_value;
};
public:
cCdrStat();
~cCdrStat();
void init();
static void init_series(vector<cChartSeries*> *series, int src_dst);
static void init_metrics(vector<sMetrics> *metrics);
void clear();
void add(sChartsCallData *call);
void store(bool forceAll = false);
void cleanup(bool forceAll = false);
void lock_intervals() { __SYNC_LOCK(sync_intervals); }
void unlock_intervals() { __SYNC_UNLOCK(sync_intervals); }
static string metrics_db_fields(vector<dstring> *fields = NULL);
static bool exists_columns_check(const char *column, int src_dst);
static void exists_columns_clear(int src_dst);
static void exists_columns_add(const char *column, int src_dst);
static inline bool enableBySrcDst(int src_dst) {
return(src_dst == 0 ? enableBySrc() : enableByDst());
}
static inline bool enableBySrc() {
extern int opt_cdr_stat_values;
return(opt_cdr_stat_values == 1 || opt_cdr_stat_values == 3);
}
static inline bool enableByDst() {
extern int opt_cdr_stat_values;
return(opt_cdr_stat_values == 2 || opt_cdr_stat_values == 3);
}
static string tableNameSuffix(int src_dst) {
return(src_dst == 0 ? "" : dstTableNameSuffix());
}
static string dstTableNameSuffix() {
return("_dst");
}
private:
eTypeStore typeStore;
vector<cChartSeries*> series_src;
vector<cChartSeries*> series_dst;
vector<sMetrics> metrics;
map<u_int32_t, cChartInterval*> intervals;
volatile u_int32_t first_interval;
unsigned maxValuesPartsForPercentile;
unsigned mainInterval;
unsigned intervalStore;
unsigned intervalCleanup;
unsigned intervalExpiration;
SqlDb *sqlDbStore;
u_int32_t last_store_at;
u_int32_t last_store_at_real;
u_int32_t last_cleanup_at;
u_int32_t last_cleanup_at_real;
volatile int sync_intervals;
static map<string, bool> exists_columns[2];
static volatile int exists_column_sync;
friend class cChartDataItem;
friend class cChartInterval;
};
struct sFilterCache_call_ipv4_comb {
union {
struct {
u_int32_t src;
u_int32_t dst;
u_int32_t proxy[2];
} d;
u_int64_t a[2];
} u;
inline void set(sChartsCallData *call);
friend inline const bool operator == (const sFilterCache_call_ipv4_comb &d1, const sFilterCache_call_ipv4_comb &d2) {
return(d1.u.a[0] == d2.u.a[0] &&
d1.u.a[1] == d2.u.a[1]);
}
friend inline const bool operator < (const sFilterCache_call_ipv4_comb &d1, const sFilterCache_call_ipv4_comb &d2) {
return(d1.u.a[0] < d2.u.a[0] ? 1 : d1.u.a[0] > d2.u.a[0] ? 0 :
d1.u.a[1] < d2.u.a[1]);
}
};
#if VM_IPV6
struct sFilterCache_call_ipv6_comb {
vmIP src;
vmIP dst;
vmIP proxy[2];
inline void set(sChartsCallData *call);
friend inline const bool operator == (const sFilterCache_call_ipv6_comb &d1, const sFilterCache_call_ipv6_comb &d2) {
return(d1.src == d2.src &&
d1.dst == d2.dst &&
d1.proxy[0] == d2.proxy[0] &&
d1.proxy[1] == d2.proxy[1]);
}
friend inline const bool operator < (const sFilterCache_call_ipv6_comb &d1, const sFilterCache_call_ipv6_comb &d2) {
return(d1.src < d2.src ? 1 : d1.src > d2.src ? 0 :
d1.dst < d2.dst ? 1 : d1.dst > d2.dst ? 0 :
d1.proxy[0] < d2.proxy[0] ? 1 : d1.proxy[0] > d2.proxy[0] ? 0 :
d1.proxy[1] < d2.proxy[1]);
}
};
#endif
class cFilterCacheItem {
public:
inline cFilterCacheItem(unsigned limit);
inline int get(sFilterCache_call_ipv4_comb *ip_comb);
inline void add(sFilterCache_call_ipv4_comb *ip_comb, bool set);
#if VM_IPV6
inline int get(sFilterCache_call_ipv6_comb *ip_comb);
inline void add(sFilterCache_call_ipv6_comb *ip_comb, bool set);
#endif
private:
unsigned limit;
queue<sFilterCache_call_ipv4_comb> ipv4_comb_queue;
map<sFilterCache_call_ipv4_comb, bool> ipv4_comb_map;
#if VM_IPV6
queue<sFilterCache_call_ipv6_comb> ipv6_comb_queue;
map<sFilterCache_call_ipv6_comb, bool> ipv6_comb_map;
#endif
};
class cFiltersCache {
public:
cFiltersCache(unsigned limit, unsigned limit2);
~cFiltersCache();
int get(cChartFilter *filter, sFilterCache_call_ipv4_comb *ip_comb);
void add(cChartFilter *filter, sFilterCache_call_ipv4_comb *ip_comb, bool set);
#if VM_IPV6
int get(cChartFilter *filter, sFilterCache_call_ipv6_comb *ip_comb);
void add(cChartFilter *filter, sFilterCache_call_ipv6_comb *ip_comb, bool set);
#endif
private:
unsigned limit, limit2;
map<cChartFilter*, cFilterCacheItem*> cache_map;
};
void chartsCacheInit(SqlDb *sqlDb);
void chartsCacheTerm();
bool chartsCacheIsSet();
void chartsCacheAddCall(sChartsCallData *call, void *callData, cFiltersCache *filtersCache, int threadIndex);
void chartsCacheStore(bool forceAll = false);
void chartsCacheCleanup(bool forceAll = false);
void chartsCacheReload();
void chartsCacheInitIntervals();
void cdrStatInit(SqlDb *sqlDb);
void cdrStatTerm();
bool cdrStatIsSet();
void cdrStatAddCall(sChartsCallData *call);
void cdrStatStore(bool forceAll = false);
void cdrStatCleanup(bool forceAll = false);
inline void chartsCacheAndCdrStatAddCall(sChartsCallData *call, void *callData, cFiltersCache *filtersCache, int threadIndex) {
chartsCacheAddCall(call, callData, filtersCache, threadIndex);
cdrStatAddCall(call);
}
inline void chartsCacheAndCdrStatStore(bool forceAll = false) {
chartsCacheStore(forceAll);
cdrStatStore(forceAll);
}
inline void chartsCacheAndCdrStatCleanup(bool forceAll = false) {
chartsCacheCleanup(forceAll);
cdrStatCleanup(forceAll);
}
#endif //CHARTS_H