summaryrefslogtreecommitdiffstats
path: root/profile
diff options
context:
space:
mode:
authorCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-05-04 00:39:35 +0300
committerCosta Tsaousis (ktsaou) <costa@tsaousis.gr>2017-05-04 00:39:35 +0300
commitb689036d47ee0004f1ac11e888073d0557e28ca9 (patch)
treed416d9ed6d71bed8b744e957c9dc973ee7ff88db /profile
parentc93f4240e3a65e3f63b3f82ed651e4caae106b9d (diff)
operational statsd with custom apps
Diffstat (limited to 'profile')
-rw-r--r--profile/statsd-stress.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/profile/statsd-stress.c b/profile/statsd-stress.c
index aebe58f6f8..05a7f5de3c 100644
--- a/profile/statsd-stress.c
+++ b/profile/statsd-stress.c
@@ -59,8 +59,8 @@ static void *report_thread(void *__data) {
return NULL;
}
-#define STATSD_METRIC_TYPES 6
-char *types[STATSD_METRIC_TYPES] = {"g", "c", "m", "ms", "h", "s"};
+char *types[] = {"g", "c", "m", "ms", "h", "s", NULL};
+// char *types[] = {"g", "c", "C", "h", "ms", NULL}; // brubeck compatible
static void *spam_thread(void *__data) {
struct thread_data *data = (struct thread_data *)__data;
@@ -73,12 +73,17 @@ static void *spam_thread(void *__data) {
char **packets = malloc(sizeof(char *) * metrics);
size_t i, *lengths = malloc(sizeof(size_t) * metrics);
+ size_t t;
- for(i = 0; i < metrics ;i++) {
- lengths[i] = sprintf(packet, "github.test.packet.%zu.%zu:%zu.%zu|%s", data->id, i, myrand(metrics), myrand(metrics), types[myrand(STATSD_METRIC_TYPES)]);
+ for(i = 0, t = 0; i < metrics ;i++, t++) {
+ if(!types[t]) t = 0;
+ char *type = types[t];
+
+ lengths[i] = sprintf(packet, "stress.%s.t%zu.m%zu:%zu|%s", type, data->id, i, myrand(metrics), type);
packets[i] = strdup(packet);
- // printf("packet %d, of length %zu: '%s'\n", i, lengths[i], packets[i]);
+ // printf("packet %zu, of length %zu: '%s'\n", i, lengths[i], packets[i]);
}
+ //printf("\n");
for (;;) {
for(i = 0; i < metrics ;i++) {