static void test_main(void *param) { int8_t result = omlc_init ("Simple"); if (result == -1) { printf ("Could not initialise OML\n"); while(1); } else if (result == 1) { printf ("OML was disabled by the user, exiting\n"); while(1); } OmlMPDef mp_def [] = { { "count", OML_UINT32_VALUE }, { "count_str", OML_STRING_VALUE }, { "count_real", OML_DOUBLE_VALUE }, { NULL, (OmlValueT)0 } }; OmlMP *mp = omlc_add_mp ("counter", mp_def); if (mp == NULL) { printf ("Error: could not register Measurement Point 'counter'"); while(1); } omlc_start(); uint32_t i = 0; for (i = 0; i < 100; i++) { uint32_t count = i; char count_str[16]; double count_real = (double)i; OmlValueU values[3]; omlc_zero_array(values, 3); snprintf(count_str, sizeof(count_str), "%d", i); omlc_set_uint32 (values[0], count); omlc_set_string (values[1], count_str); omlc_set_double (values[2], count_real); omlc_inject (mp, values); omlc_reset_string(values[1]); } omlc_close(); while(1); }
void routing_stats::inject_into_oml(unsigned mp_index){ OmlValueU v[13]; omlc_zero_array(v, 13); omlc_set_uint32(v[0], mp_index); omlc_set_string(v[1], node_id.c_str()); omlc_set_uint64(v[2], in_chunks); omlc_set_uint64(v[3], out_chunks); omlc_set_uint64(v[4], in_ctrl_msgs); omlc_set_uint64(v[5], out_ctrl_msgs); omlc_set_uint64(v[6], stored_chunks); omlc_set_uint64(v[7], error_chunks); omlc_set_uint64(v[8], dropped_chunks); omlc_set_uint64(v[9], in_data_bytes); omlc_set_uint64(v[10], out_data_bytes); omlc_set_uint64(v[11], in_ctrl_bytes); omlc_set_uint64(v[12], out_ctrl_bytes); omlc_inject(oml_mp, v); omlc_reset_string(v[1]); #ifdef DEBUG char msg[500]; sprintf(msg, "ROUTING(node: %s):\n" "ts i-C o-C s-C e-C d-C i-dB o-dB i-cP o-cP i-cB o-cB\n" "%llu %llu %llu %llu %llu %llu %llu %llu %llu %lld %llu %llu", node_id.c_str(), t_stamp, in_chunks, out_chunks, stored_chunks, error_chunks, dropped_chunks, in_data_bytes, out_data_bytes, in_ctrl_msgs, out_ctrl_msgs, in_ctrl_bytes, out_ctrl_bytes ); cout << "DEBUG: " << msg << endl; #endif }