]> git.itanic.dy.fi Git - rrdd/blob - main.c
Initial comit
[rrdd] / main.c
1 #include <sys/types.h>
2 #include <unistd.h>
3
4 #include "process.h"
5 #include "draw_graphs.h"
6 #include "parser.h"
7 #include "scheduler.h"
8
9 #include "testdata.h"
10
11
12 int main(int argc, char *argv[])
13 {
14 //      draw_image(&cpudaily);
15
16 //      draw_images(&all_images);
17
18 //      update_data(&cpumem_rrd);
19
20         struct rrd_database *db;
21         int sleeptime;
22
23         while (1) {
24                 printf("%d: loop start\n", getpid());
25                 /*
26                  * Update all databases parallel in one shot
27                  */
28                 while ((db = check_update_need(&all_rrds)))
29                         update_data(db);
30
31                 /*
32                  * Let the updates finish
33                  */
34                 if (harvest_zombies())
35                         continue;
36
37                 sleeptime = get_next_update(&all_rrds);
38                 printf("Time to sleep %d seconds\n", sleeptime);
39                 sleep(sleeptime);
40
41         }
42         return 0;
43 }