OML Data Definition Igor Macedo, UNIFACS UNIFACS-Fibre Meeting 1.
-
Upload
clarence-henry -
Category
Documents
-
view
216 -
download
2
Transcript of OML Data Definition Igor Macedo, UNIFACS UNIFACS-Fibre Meeting 1.
OML Data Definition
Igor Macedo, UNIFACS
UNIFACS-Fibre Meeting
1
Agenda
• Measurement Point– Creation and Definition– Registration
• Data Persistence• Data Export
2
Measurement Points (1)
• It’s the way OML define it data• To define/register a OML MP:
– Create a OmlMPDef array. This array defines the data to be stored in a relational database (sqlite3), like a table;
– Use the function omlc_add_mp, to register the “table” in the database
– To insert the data into the database, use the function oml_inject
3
Measurement Points (2)
4
#include <stdio.h>#include <stdlib.h>#include <oml2/omlc.h>int main (int argc, const char **argv){ int result = omlc_init ("Simple", &argc, argv, NULL); if (result == -1) { fprintf (stderr, "Could not initialize OML\n"); exit (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) { fprintf (stderr, "Error: could not register Measurement Point 'counter'"); exit (1); }
omlc_start(); int i = 0; for (i = 0; i < 1000; i++) { uint32_t count = (uint32_t)i; char count_str[16]; double count_real = (double)i; OmlValueU 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_close(); return 0;}
Measurement Points (3)
5
...OmlMPDef mp_def = { {"oml_sender_id", OML_INT32_VALUE}, {"oml_seq", OML_INT32_VALUE}, {"oml_ts_client", OML_DOUBLE_VALUE}, {"oml_ts_server", OML_DOUBLE_VALUE}, {"ts", OML_DOUBLE_VALUE}, {"flow_id", OML_INT32_VALUE}, {"seq_no", OML_INT32_VALUE}, {"pkt_length", OML_INT32_VALUE}, {"dst_host", OML_STRING_VALUE}, {"dst_port", OML_INT32_VALUE}}...OmlMP *mp = oml_add_mp (“otg2_udp_out”, mp_def);...omlc_inject(mp, values);
CREATE TABLE "otg2_udp_out" (oml_sender_id INTEGER, oml_seq INTEGER, oml_ts_client REAL, oml_ts_server REAL, "ts" REAL, "flow_id" INTEGER, "seq_no" UNSIGNED INTEGER, "pkt_length" UNSIGNED INTEGER, "dst_host" TEXT, "dst_port" UNSIGNED INTEGER);
INSERT INTO "otg2_udp_out" VALUES(1,1,3.66233599931002,0.688537,1.66233599931002,1,1,512,'192.168.0.3',3000);
INSERT INTO "otg2_udp_out" VALUES(1,2,4.66239899769425,1.68603,2.66239899769425,1,2,512,'192.168.0.3',3000);
INSERT INTO "otg2_udp_out" VALUES(1,3,5.66246099770069,2.685982,3.66246099770069,1,3,512,'192.168.0.3',3000);
INSERT INTO "otg2_udp_out" VALUES(1,4,6.66252399981022,3.685973,4.66252399981022,1,4,512,'192.168.0.3',3000);
Data Persistence
6
Data Export
7
MDIP Proposal
8