Index: trunk/udpprofile/export.c |
— | — | @@ -23,6 +23,7 @@ |
24 | 24 | |
25 | 25 | char *p, oldhost[128]="",olddb[128]="",*pp; |
26 | 26 | int indb=0,inhost=0; |
| 27 | + int i, points; |
27 | 28 | |
28 | 29 | struct pfstats *entry; |
29 | 30 | |
— | — | @@ -65,11 +66,20 @@ |
66 | 67 | "<stats count=\"%lu\">\n" \ |
67 | 68 | "<cputime total=\"%lf\" totalsq=\"%lf\" />\n" \ |
68 | 69 | "<realtime total=\"%lf\" totalsq=\"%lf\" />\n" \ |
69 | | - "</stats></event>\n", |
| 70 | + "<samples real=\"", |
70 | 71 | (int)(key.size - ((void *)p-(void *)key.data)),p, |
71 | 72 | entry->pf_count, entry->pf_cpu, entry->pf_cpu_sq, |
72 | 73 | entry->pf_real, entry->pf_real_sq); |
73 | | - |
| 74 | + if (entry->pf_count >= POINTS) { |
| 75 | + points = POINTS; |
| 76 | + } else { |
| 77 | + points = entry->pf_count; |
| 78 | + } |
| 79 | + for (i=0; i<points; i++) { |
| 80 | + fprintf(fd,"%lf ", entry->pf_reals[i]); |
| 81 | + } |
| 82 | + fprintf(fd,"\" />\n" \ |
| 83 | + "</stats></event>\n"); |
74 | 84 | } |
75 | 85 | fprintf(fd,"</host>\n</db>\n</pfdump>\n"); |
76 | 86 | c->c_close(c); |
Index: trunk/udpprofile/collector.c |
— | — | @@ -151,9 +151,17 @@ |
152 | 152 | old->pf_cpu_sq += incoming.pf_cpu_sq; |
153 | 153 | old->pf_real += incoming.pf_real; |
154 | 154 | old->pf_real_sq += incoming.pf_real_sq; |
| 155 | + old->pf_reals[old->pf_real_pointer] = incoming.pf_real; |
| 156 | + if (old->pf_real_pointer == POINTS-1) { |
| 157 | + old->pf_real_pointer = 0; |
| 158 | + } else { |
| 159 | + old->pf_real_pointer++; |
| 160 | + } |
155 | 161 | db->put(db,NULL,&key,&data,0); |
156 | 162 | } else { |
157 | 163 | /* Put in fresh data */ |
| 164 | + incoming.pf_real_pointer = 1; |
| 165 | + incoming.pf_reals[0] = incoming.pf_real; |
158 | 166 | data.data=&incoming; |
159 | 167 | data.size=sizeof(incoming); |
160 | 168 | db->put(db,NULL,&key,&data,0); |
Index: trunk/udpprofile/collector.h |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | |
5 | 5 | #include <stdio.h> |
6 | 6 | #include <db.h> |
7 | | - |
| 7 | +#define POINTS 300 |
8 | 8 | DB *db; |
9 | 9 | |
10 | 10 | /* Stats variables, not that generic, are they? */ |
— | — | @@ -14,6 +14,8 @@ |
15 | 15 | double pf_cpu_sq; |
16 | 16 | double pf_real; |
17 | 17 | double pf_real_sq; |
| 18 | + int pf_real_pointer; |
| 19 | + double pf_reals[POINTS]; |
18 | 20 | }; |
19 | 21 | |
20 | 22 | void dumpData(FILE *); |