Merging serial model from branch; converting to the hideous indentation style of...
[lwes-journaller.git] / src / stats.h
blob5bf0561c970763cea87e1dd9e41f94e56a17f8fd
1 /*======================================================================*
2 * Copyright (C) 2008 Light Weight Event System *
3 * All rights reserved. *
4 * *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
18 * Boston, MA 02110-1301 USA. *
19 *======================================================================*/
21 #ifndef STATS_DOT_H
22 #define STATS_DOT_H
24 #include <time.h>
25 #include "header.h"
27 struct enqueuer_stats {
28 long long socket_errors_since_last_rotate;
30 long long bytes_received_total;
31 long long bytes_received_since_last_rotate;
33 long long packets_received_total;
34 long long packets_received_since_last_rotate;
36 time_t start_time;
37 time_t last_rotate;
40 struct dequeuer_stats {
41 long long loss_since_last_rotate;
43 long long bytes_written_total;
44 long long bytes_written_since_last_rotate;
46 long long packets_written_total;
47 long long packets_written_since_last_rotate;
49 long long bytes_written_in_burst;
50 long long packets_written_in_burst;
52 int hiq; /* Peak packet count in queue. */
54 time_t hiq_start; /* When this burst started. */
55 time_t hiq_last; /* When the previous burst started. */
57 int hiq_since_last_rotate; /* Highest high water mark since last rotate. */
59 long long bytes_written_in_burst_since_last_rotate;
60 long long packets_written_in_burst_since_last_rotate;
62 time_t start_time;
63 time_t last_rotate;
65 char latest_rotate_header[HEADER_LENGTH] ; /* Of the Command::Rotate that was acted on */
68 unsigned long long time_in_milliseconds (void);
70 int enqueuer_stats_ctor (struct enqueuer_stats* this_stats);
71 void stats_enqueuer_rotate (struct enqueuer_stats* this_stats);
72 void enqueuer_stats_record_socket_error (struct enqueuer_stats* this_stats);
73 void enqueuer_stats_record_datagram (struct enqueuer_stats* this_stats, int bytes);
74 void enqueuer_stats_rotate (struct enqueuer_stats* this_stats);
75 void enqueuer_stats_report (struct enqueuer_stats* this_stats);
77 int dequeuer_stats_ctor (struct dequeuer_stats* this_stats);
78 void dequeuer_stats_record (struct dequeuer_stats* this_stats, int bytes, int pending);
79 void dequeuer_stats_record_loss (struct dequeuer_stats* this_stats);
80 void dequeuer_stats_rotate (struct dequeuer_stats* this_stats);
81 void dequeuer_stats_report (struct dequeuer_stats* this_stats);
83 #endif /* STATS_DOT_H */