aboutsummaryrefslogtreecommitdiff
path: root/src/wydawca.h
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2020-04-25 21:52:09 +0300
committerSergey Poznyakoff <gray@gnu.org>2020-04-25 22:00:26 +0300
commitfbb142ae5a57ab227e46ff6ffeb4b29db000034f (patch)
treecc237b384f298a892a64848a2631c96432cceab7 /src/wydawca.h
parent68d0e67d55882d1298bb0bf89c954c0ff2b1b823 (diff)
downloadwydawca-fbb142ae5a57ab227e46ff6ffeb4b29db000034f.tar.gz
wydawca-fbb142ae5a57ab227e46ff6ffeb4b29db000034f.tar.bz2
Keep statistic items in global array. Use special thread for periodic reporting
* src/config.c: New configuration statement stat-report-interval * src/directive.c * src/timer.c: Rewrite statistic counters and functions (wydawca_stat_log,wydawca_stat_init,wydawca_stat_update) (wydawca_stat_notify,wydawca_stat_add): New functions. (wy_thr_stat): New thread (statistics reporter. * src/triplet.c: Remove per-thread statistic counters. * src/wydawca.c (wy_main): Use new statistic calls. Force statistic logging at the end of the run. * src/wydawca.h (DEFAULT_STAT_REPORT_INTERVAL): New constant. (stat_report_interval): New extern. (wy_get_stat_array, wy_get_stat_slot) (wy_get_stat_counter): Remove. (wydawca_stat_log,wydawca_stat_init,wydawca_stat_update) (wydawca_stat_notify,wydawca_stat_add) (wydawca_stat_incr): New protos. (stat_mask_p,logstats,wydawca_stats_export) (wydawca_stats_update): Remove protos.
Diffstat (limited to 'src/wydawca.h')
-rw-r--r--src/wydawca.h29
1 files changed, 9 insertions, 20 deletions
diff --git a/src/wydawca.h b/src/wydawca.h
index 825f30b..0a926e6 100644
--- a/src/wydawca.h
+++ b/src/wydawca.h
@@ -63,6 +63,7 @@ void wy_set_cur_thread_name(char const *name);
#define SP(s) ((s) ? (s) : "NONE")
#define DEFAULT_FILE_SWEEP_TIME 300
+#define DEFAULT_STAT_REPORT_INTERVAL 3600
/* The range of directive versions we accept (major * 100 + minor) */
#define MIN_DIRECTIVE_VERSION 101
@@ -319,6 +320,7 @@ extern char *conffile; /* Configuration file name */
extern int syslog_include_prio; /* Syslog priority indication */
extern time_t file_sweep_time; /* Unlink stale file after this amount of time
*/
+extern time_t stat_report_interval;
extern char *tar_command_name; /* Name of the tar command */
extern unsigned long print_stats;
extern int archive_signatures;
@@ -353,31 +355,18 @@ extern struct notification *default_notification;
extern size_t spool_count;
typedef unsigned WY_STAT_COUNTER;
-WY_STAT_COUNTER *wy_get_stat_array(void);
-
-static inline WY_STAT_COUNTER *
-wy_get_stat_slot(int what)
-{
- return wy_get_stat_array() + what;
-}
-
-static inline WY_STAT_COUNTER
-wy_get_stat_counter(int what)
-{
- return *wy_get_stat_slot(what);
-}
+void wydawca_stat_log(void);
+void wydawca_stat_init(void);
+void wydawca_stat_update(void);
+void wydawca_stat_notify(int final);
+void wydawca_stat_add(int what, size_t n);
static inline void
-increase_stat_counter(int what)
+wydawca_stat_incr(int what)
{
- if (what >= WY_MAX_STAT) abort();
- ++*wy_get_stat_slot(what);
+ wydawca_stat_add(what, 1);
}
-int stat_mask_p(unsigned long mask);
-void logstats(void);
-void wydawca_stats_export(void);
-void wydawca_stats_update(void);
/* Utility functions */
char *safe_file_name(char *file_name);

Return to:

Send suggestions and report system problems to the System administrator.