aboutsummaryrefslogtreecommitdiff
path: root/src/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stat.c')
-rw-r--r--src/stat.c65
1 files changed, 35 insertions, 30 deletions
diff --git a/src/stat.c b/src/stat.c
index ed4ab8e..85b76d9 100644
--- a/src/stat.c
+++ b/src/stat.c
@@ -46,5 +46,5 @@ interpolate (queue_t *q,
46 th.inrate = inrate; 46 th.inrate = inrate;
47 th.outrate = outrate; 47 th.outrate = outrate;
48 verbose (3, "Insert %lu %g %g", next, th.inrate, th.outrate); 48 verbose (3, _("insert %lu %g %g"), next, th.inrate, th.outrate);
49 queue_put (q, &th); 49 queue_put (q, &th);
50 if (ovf) 50 if (ovf)
@@ -59,5 +59,5 @@ interpolate (queue_t *q,
59 th.outrate = (outrate - last_rates->outrate) * (next - last_time) 59 th.outrate = (outrate - last_rates->outrate) * (next - last_time)
60 / interval + last_rates->outrate; 60 / interval + last_rates->outrate;
61 verbose (3, "Insert %lu %g %g", next, th.inrate, th.outrate); 61 verbose (3, _("insert %lu %g %g"), next, th.inrate, th.outrate);
62 queue_put (q, &th); 62 queue_put (q, &th);
63 if (ovf) 63 if (ovf)
@@ -93,5 +93,5 @@ overflow (struct traffic_history *th,
93 tmp.inrate = avg->inrate; 93 tmp.inrate = avg->inrate;
94 tmp.outrate = avg->outrate; 94 tmp.outrate = avg->outrate;
95 verbose (3, "Insert %lu %g %g", now, tmp.inrate, tmp.outrate); 95 verbose (3, _("insert %lu %g %g"), now, tmp.inrate, tmp.outrate);
96 queue_put (q, &tmp); 96 queue_put (q, &tmp);
97 } 97 }
@@ -109,8 +109,9 @@ int
109ovf_monthly (struct traffic_history *th, struct traffic_record *tr, time_t now) 109ovf_monthly (struct traffic_history *th, struct traffic_record *tr, time_t now)
110{ 110{
111 verbose (2, "begin overflow_monthly %lu %g %g", now, th->inrate, th->outrate); 111 verbose (2, _("begin overflow_monthly %lu %g %g"),
112 now, th->inrate, th->outrate);
112 overflow (th, tr, now, NULL, &tr->year_avg, &tr->year_hist, 113 overflow (th, tr, now, NULL, &tr->year_avg, &tr->year_hist,
113 YEAR_COUNT, YEAR_SAMPLE); 114 YEAR_COUNT, YEAR_SAMPLE);
114 verbose (2, "end overflow_monthly"); 115 verbose (2, _("end overflow_monthly"));
115} 116}
116 117
@@ -118,8 +119,9 @@ int
118ovf_weekly (struct traffic_history *th, struct traffic_record *tr, time_t now) 119ovf_weekly (struct traffic_history *th, struct traffic_record *tr, time_t now)
119{ 120{
120 verbose (2, "begin overflow_weekly %lu %g %g", now, th->inrate, th->outrate); 121 verbose (2, _("begin overflow_weekly %lu %g %g"),
122 now, th->inrate, th->outrate);
121 overflow (th, tr, now, ovf_monthly, &tr->month_avg, &tr->month_hist, 123 overflow (th, tr, now, ovf_monthly, &tr->month_avg, &tr->month_hist,
122 MONTH_COUNT, MONTH_SAMPLE); 124 MONTH_COUNT, MONTH_SAMPLE);
123 verbose (2, "end overflow_daily"); 125 verbose (2, _("end overflow_daily"));
124} 126}
125 127
@@ -127,8 +129,9 @@ int
127ovf_daily (struct traffic_history *th, struct traffic_record *tr, time_t now) 129ovf_daily (struct traffic_history *th, struct traffic_record *tr, time_t now)
128{ 130{
129 verbose (2, "begin overflow_daily %lu %g %g", now, th->inrate, th->outrate); 131 verbose (2, _("begin overflow_daily %lu %g %g"),
132 now, th->inrate, th->outrate);
130 overflow (th, tr, now, ovf_weekly, &tr->week_avg, &tr->week_hist, 133 overflow (th, tr, now, ovf_weekly, &tr->week_avg, &tr->week_hist,
131 WEEK_COUNT, WEEK_SAMPLE); 134 WEEK_COUNT, WEEK_SAMPLE);
132 verbose (2, "end overflow_daily"); 135 verbose (2, _("end overflow_daily"));
133} 136}
134 137
@@ -145,5 +148,5 @@ update_stats (struct monitor *mon, struct traffic_sample *sample,
145 if (interval == 0) 148 if (interval == 0)
146 { 149 {
147 logmsg (L_ERR, "Ignoring zero interval"); 150 logmsg (L_ERR, _("ignoring zero interval"));
148 return; 151 return;
149 } 152 }
@@ -218,5 +221,5 @@ _convert (queue_t *q, ovf_t ovf,
218 if (interval == 0) 221 if (interval == 0)
219 { 222 {
220 logmsg (L_ERR, "Ignoring zero interval"); 223 logmsg (L_ERR, _("ignoring zero interval"));
221 break; 224 break;
222 } 225 }
@@ -253,9 +256,9 @@ convert_yearly (struct traffic_record *tr, struct traffic_sample *hp,
253 size_t count) 256 size_t count)
254{ 257{
255 verbose (2, "begin convert_yearly"); 258 verbose (2, _("begin convert_yearly"));
256 _convert (&tr->year_hist, NULL, tr, 259 _convert (&tr->year_hist, NULL, tr,
257 hp, count, YEAR_SAMPLE); 260 hp, count, YEAR_SAMPLE);
258 compute_avg (&tr->year_avg, &tr->year_hist, &tr->last); 261 compute_avg (&tr->year_avg, &tr->year_hist, &tr->last);
259 verbose (2, "end convert_yearly"); 262 verbose (2, _("end convert_yearly"));
260} 263}
261 264
@@ -264,5 +267,5 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp,
264 size_t count) 267 size_t count)
265{ 268{
266 verbose (2, "begin convert_monthly"); 269 verbose (2, _("begin convert_monthly"));
267 if (count > MONTH_COUNT+1) 270 if (count > MONTH_COUNT+1)
268 convert_yearly (tr, hp + MONTH_COUNT + 1, count - (MONTH_COUNT + 1)); 271 convert_yearly (tr, hp + MONTH_COUNT + 1, count - (MONTH_COUNT + 1));
@@ -270,5 +273,5 @@ convert_monthly (struct traffic_record *tr, struct traffic_sample *hp,
270 hp, MONTH_COUNT + 1, MONTH_SAMPLE); 273 hp, MONTH_COUNT + 1, MONTH_SAMPLE);
271 compute_avg (&tr->month_avg, &tr->month_hist, &tr->last); 274 compute_avg (&tr->month_avg, &tr->month_hist, &tr->last);
272 verbose (2, "end convert_monthly"); 275 verbose (2, _("end convert_monthly"));
273} 276}
274 277
@@ -276,5 +279,5 @@ static void
276convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t count) 279convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t count)
277{ 280{
278 verbose (2, "begin convert_weekly"); 281 verbose (2, _("begin convert_weekly"));
279 if (count > WEEK_COUNT+1) 282 if (count > WEEK_COUNT+1)
280 convert_monthly (tr, hp + WEEK_COUNT + 1, count - (WEEK_COUNT + 1)); 283 convert_monthly (tr, hp + WEEK_COUNT + 1, count - (WEEK_COUNT + 1));
@@ -282,5 +285,5 @@ convert_weekly (struct traffic_record *tr, struct traffic_sample *hp, size_t cou
282 tr, hp, WEEK_COUNT + 1, WEEK_SAMPLE); 285 tr, hp, WEEK_COUNT + 1, WEEK_SAMPLE);
283 compute_avg (&tr->week_avg, &tr->week_hist, &tr->last); 286 compute_avg (&tr->week_avg, &tr->week_hist, &tr->last);
284 verbose (2, "end convert_weekly"); 287 verbose (2, _("end convert_weekly"));
285} 288}
286 289
@@ -288,9 +291,9 @@ static void
288convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t count) 291convert_daily (struct traffic_record *tr, struct traffic_sample *hp, size_t count)
289{ 292{
290 verbose (2, "begin convert_daily"); 293 verbose (2, _("begin convert_daily"));
291 if (count > DAY_COUNT+1) 294 if (count > DAY_COUNT+1)
292 convert_weekly (tr, hp + DAY_COUNT + 1, count - (DAY_COUNT + 1)); 295 convert_weekly (tr, hp + DAY_COUNT + 1, count - (DAY_COUNT + 1));
293 _convert (&tr->day_hist, ovf_daily, tr, hp, DAY_COUNT + 1, DAY_SAMPLE); 296 _convert (&tr->day_hist, ovf_daily, tr, hp, DAY_COUNT + 1, DAY_SAMPLE);
294 verbose (2, "end convert_daily"); 297 verbose (2, _("end convert_daily"));
295} 298}
296 299
@@ -330,13 +333,13 @@ import_log (const char *name)
330 if (!fp) 333 if (!fp)
331 { 334 {
332 logmsg (L_ERR, "cannot open `%s': %s", name, strerror (errno)); 335 logmsg (L_ERR, _("cannot open `%s': %s"), name, strerror (errno));
333 return 1; 336 return 1;
334 } 337 }
335 verbose (2, "Importing %s", name); 338 verbose (2, _("importing %s"), name);
336 339
337 340
338 if (fscanf (fp, "%ld %lu %lu\n", &last.time, &last.in, &last.out) != 3) 341 if (fscanf (fp, "%ld %lu %lu\n", &last.time, &last.in, &last.out) != 3)
339 { 342 {
340 logmsg (L_ERR, "%s:1: Unexpected number of fields", name); 343 logmsg (L_ERR, _("%s:1: unexpected number of fields"), name);
341 fclose (fp); 344 fclose (fp);
342 return 1; 345 return 1;
@@ -365,5 +368,5 @@ import_log (const char *name)
365 if (hist.time > cur) 368 if (hist.time > cur)
366 { 369 {
367 logmsg (L_WARNING, "%s:%lu: is corrupted", name, line); 370 logmsg (L_WARNING, _("%s:%lu: is corrupted"), name, line);
368 break; 371 break;
369 } 372 }
@@ -400,5 +403,5 @@ import_log (const char *name)
400 if (!mon) 403 if (!mon)
401 { 404 {
402 logmsg (L_ERR, "cannot find monitor `%s'", base); 405 logmsg (L_ERR, _("cannot find monitor `%s'"), base);
403 rc = 1; 406 rc = 1;
404 } 407 }
@@ -417,8 +420,9 @@ import (const char *dirname)
417 struct stat st; 420 struct stat st;
418 421
419 verbose (2, "Examining `%s'", dirname); 422 verbose (2, _("examining `%s'"), dirname);
420 423
421 if (stat (dirname, &st)) 424 if (stat (dirname, &st))
422 die (EX_OSERR, "cannot stat file `%s': %s", dirname, strerror (errno)); 425 die (EX_OSERR, _("cannot stat file `%s': %s"),
426 dirname, strerror (errno));
423 else if (S_ISREG (st.st_mode)) 427 else if (S_ISREG (st.st_mode))
424 { 428 {
@@ -451,8 +455,9 @@ import (const char *dirname)
451 455
452 case GLOB_NOSPACE: 456 case GLOB_NOSPACE:
453 die (EX_UNAVAILABLE, "cannot scan directory: %s", strerror (ENOMEM)); 457 die (EX_UNAVAILABLE, _("cannot scan directory: %s"),
458 strerror (ENOMEM));
454 459
455 case GLOB_ABORTED: 460 case GLOB_ABORTED:
456 die (EX_UNAVAILABLE, "scanning aborted"); 461 die (EX_UNAVAILABLE, _("scanning aborted"));
457 462
458 case GLOB_NOMATCH: 463 case GLOB_NOMATCH:
@@ -460,9 +465,9 @@ import (const char *dirname)
460 465
461 default: 466 default:
462 die (EX_UNAVAILABLE, "cannot scan directory `%s'", dirname); 467 die (EX_UNAVAILABLE, _("cannot scan directory `%s'"), dirname);
463 } 468 }
464 } 469 }
465 470
466 verbose (1, "Number of imported log files: %d", count); 471 verbose (1, _("number of imported log files: %d"), count);
467} 472}
468 473

Return to:

Send suggestions and report system problems to the System administrator.