Initial VES for DANOS vRouter
[demo.git] / vnfs / VESreporting_vFW5.0_DANOS / evel / evel-library / code / evel_library / evel_scaling_measurement.c
1 /*************************************************************************//**
2  *
3  * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
4  *
5  * Unless otherwise specified, all software contained herein is
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *        http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and 
15  * limitations under the License.
16  * ECOMP is a trademark and service mark of AT&T Intellectual Property.
17  ****************************************************************************/
18 /**************************************************************************//**
19  * @file
20  * Implementation of EVEL functions relating to the Measurement.
21  *
22  ****************************************************************************/
23
24 #include <string.h>
25 #include <assert.h>
26 #include <stdlib.h>
27
28 #include "evel.h"
29 #include "evel_internal.h"
30 #include "evel_throttle.h"
31
32 /**************************************************************************//**
33  * Create a new Measurement event.
34  *
35  * @note    The mandatory fields on the Measurement must be supplied to this
36  *          factory function and are immutable once set.  Optional fields have
37  *          explicit setter functions, but again values may only be set once so
38  *          that the Measurement has immutable properties.
39  *
40  * @param   measurement_interval
41  * @param event_name  Unique Event Name confirming Domain AsdcModel Description
42  * @param event_id    A universal identifier of the event for: troubleshooting correlation, analysis, etc
43  *
44  * @returns pointer to the newly manufactured ::EVENT_MEASUREMENT.  If the
45  *          event is not used (i.e. posted) it must be released using
46  *          ::evel_free_event.
47  * @retval  NULL  Failed to create the event.
48  *****************************************************************************/
49 EVENT_MEASUREMENT * evel_new_measurement(double measurement_interval, const char* ev_name, const char *ev_id)
50 {
51   EVENT_MEASUREMENT * measurement = NULL;
52
53   EVEL_ENTER();
54
55   /***************************************************************************/
56   /* Check preconditions.                                                    */
57   /***************************************************************************/
58   assert(measurement_interval >= 0.0);
59
60   /***************************************************************************/
61   /* Allocate the measurement.                                               */
62   /***************************************************************************/
63   measurement = malloc(sizeof(EVENT_MEASUREMENT));
64   if (measurement == NULL)
65   {
66     log_error_state("Out of memory for Measurement");
67     goto exit_label;
68   }
69   memset(measurement, 0, sizeof(EVENT_MEASUREMENT));
70   EVEL_DEBUG("New measurement is at %lp", measurement);
71
72   /***************************************************************************/
73   /* Initialize the header & the measurement fields.                         */
74   /***************************************************************************/
75   evel_init_header_nameid(&measurement->header,ev_name,ev_id);
76   measurement->header.event_domain = EVEL_DOMAIN_MEASUREMENT;
77   measurement->measurement_interval = measurement_interval;
78   dlist_initialize(&measurement->additional_info);
79   dlist_initialize(&measurement->additional_measurements);
80   dlist_initialize(&measurement->additional_objects);
81   dlist_initialize(&measurement->cpu_usage);
82   dlist_initialize(&measurement->disk_usage);
83   dlist_initialize(&measurement->mem_usage);
84   dlist_initialize(&measurement->filesystem_usage);
85   dlist_initialize(&measurement->latency_distribution);
86   dlist_initialize(&measurement->vnic_usage);
87   dlist_initialize(&measurement->codec_usage);
88   dlist_initialize(&measurement->feature_usage);
89   evel_init_option_double(&measurement->mean_request_latency);
90   evel_init_option_int(&measurement->vnfc_scaling_metric);
91   evel_init_option_int(&measurement->concurrent_sessions);
92   evel_init_option_int(&measurement->configured_entities);
93   evel_init_option_int(&measurement->media_ports_in_use);
94   evel_init_option_int(&measurement->request_rate);
95   measurement->major_version = EVEL_MEASUREMENT_MAJOR_VERSION;
96   measurement->minor_version = EVEL_MEASUREMENT_MINOR_VERSION;
97
98 exit_label:
99   EVEL_EXIT();
100   return measurement;
101 }
102
103 /**************************************************************************//**
104  * Set the Event Type property of the Measurement.
105  *
106  * @note  The property is treated as immutable: it is only valid to call
107  *        the setter once.  However, we don't assert if the caller tries to
108  *        overwrite, just ignoring the update instead.
109  *
110  * @param measurement Pointer to the Measurement.
111  * @param type        The Event Type to be set. ASCIIZ string. The caller
112  *                    does not need to preserve the value once the function
113  *                    returns.
114  *****************************************************************************/
115 void evel_measurement_type_set(EVENT_MEASUREMENT * measurement,
116                                const char * const type)
117 {
118   EVEL_ENTER();
119
120   /***************************************************************************/
121   /* Check preconditions and call evel_header_type_set.                      */
122   /***************************************************************************/
123   assert(measurement != NULL);
124   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
125   evel_header_type_set(&measurement->header, type);
126
127   EVEL_EXIT();
128 }
129
130 /**************************************************************************//**
131  * Add an additional value name/value pair to the Measurement.
132  *
133  * The name and value are null delimited ASCII strings.  The library takes
134  * a copy so the caller does not have to preserve values after the function
135  * returns.
136  *
137  * @param measurement     Pointer to the measurement.
138  * @param name      ASCIIZ string with the attribute's name.  The caller
139  *                  does not need to preserve the value once the function
140  *                  returns.
141  * @param value     ASCIIZ string with the attribute's value.  The caller
142  *                  does not need to preserve the value once the function
143  *                  returns.
144  *****************************************************************************/
145 void evel_measurement_addl_info_add(EVENT_MEASUREMENT * measurement, char * name, char * value)
146 {
147   OTHER_FIELD * addl_info = NULL;
148   EVEL_ENTER();
149
150   /***************************************************************************/
151   /* Check preconditions.                                                    */
152   /***************************************************************************/
153   assert(measurement != NULL);
154   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
155   assert(name != NULL);
156   assert(value != NULL);
157   
158   EVEL_DEBUG("Adding name=%s value=%s", name, value);
159   addl_info = malloc(sizeof(OTHER_FIELD));
160   assert(addl_info != NULL);
161   memset(addl_info, 0, sizeof(OTHER_FIELD));
162   addl_info->name = strdup(name);
163   addl_info->value = strdup(value);
164   assert(addl_info->name != NULL);
165   assert(addl_info->value != NULL);
166
167   dlist_push_last(&measurement->additional_info, addl_info);
168
169   EVEL_EXIT();
170 }
171
172 /**************************************************************************//**
173  * Add a json object to jsonObject list.
174  *
175  * The name and value are null delimited ASCII strings.  The library takes
176  * a copy so the caller does not have to preserve values after the function
177  * returns.
178  *
179  * @param measurement     Pointer to the ScalingMeasurement
180  * @param jsonobj   Pointer to json object
181  *****************************************************************************/
182 void evel_measurement_addl_object_add(EVENT_MEASUREMENT * measurement, EVEL_JSON_OBJECT *jsonobj)
183 {
184   EVEL_ENTER();
185
186   /***************************************************************************/
187   /* Check preconditions.                                                    */
188   /***************************************************************************/
189   assert(measurement != NULL);
190   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
191   assert(jsonobj != NULL);
192
193   EVEL_DEBUG("Adding jsonObject %p",jsonobj);
194
195   dlist_push_last(&measurement->additional_objects, jsonobj);
196
197   EVEL_EXIT();
198 }
199
200
201 /**************************************************************************//**
202  * Set the Concurrent Sessions property of the Measurement.
203  *
204  * @note  The property is treated as immutable: it is only valid to call
205  *        the setter once.  However, we don't assert if the caller tries to
206  *        overwrite, just ignoring the update instead.
207  *
208  * @param measurement         Pointer to the Measurement.
209  * @param concurrent_sessions The Concurrent Sessions to be set.
210  *****************************************************************************/
211 void evel_measurement_conc_sess_set(EVENT_MEASUREMENT * measurement,
212                                     int concurrent_sessions)
213 {
214   EVEL_ENTER();
215
216   /***************************************************************************/
217   /* Check preconditions.                                                    */
218   /***************************************************************************/
219   assert(measurement != NULL);
220   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
221   assert(concurrent_sessions >= 0);
222
223   evel_set_option_int(&measurement->concurrent_sessions,
224                       concurrent_sessions,
225                       "Concurrent Sessions");
226   EVEL_EXIT();
227 }
228
229 /**************************************************************************//**
230  * Set the Configured Entities property of the Measurement.
231  *
232  * @note  The property is treated as immutable: it is only valid to call
233  *        the setter once.  However, we don't assert if the caller tries to
234  *        overwrite, just ignoring the update instead.
235  *
236  * @param measurement         Pointer to the Measurement.
237  * @param configured_entities The Configured Entities to be set.
238  *****************************************************************************/
239 void evel_measurement_cfg_ents_set(EVENT_MEASUREMENT * measurement,
240                                    int configured_entities)
241 {
242   EVEL_ENTER();
243
244   /***************************************************************************/
245   /* Check preconditions.                                                    */
246   /***************************************************************************/
247   assert(measurement != NULL);
248   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
249   assert(configured_entities >= 0);
250
251   evel_set_option_int(&measurement->configured_entities,
252                       configured_entities,
253                       "Configured Entities");
254   EVEL_EXIT();
255 }
256
257 /**************************************************************************//**
258  * Add an additional set of Errors to the Measurement.
259  *
260  * @note  The property is treated as immutable: it is only valid to call
261  *        the setter once.  However, we don't assert if the caller tries to
262  *        overwrite, just ignoring the update instead.
263  *
264  * @param measurement       Pointer to the measurement.
265  * @param receive_discards  The number of receive discards.
266  * @param receive_errors    The number of receive errors.
267  * @param transmit_discards The number of transmit discards.
268  * @param transmit_errors   The number of transmit errors.
269  *****************************************************************************/
270 void evel_measurement_errors_set(EVENT_MEASUREMENT * measurement,
271                                  int receive_discards,
272                                  int receive_errors,
273                                  int transmit_discards,
274                                  int transmit_errors)
275 {
276   MEASUREMENT_ERRORS * errors = NULL;
277   EVEL_ENTER();
278
279   /***************************************************************************/
280   /* Check preconditions.                                                      */
281   /***************************************************************************/
282   assert(measurement != NULL);
283   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
284   assert(receive_discards >= 0);
285   assert(receive_errors >= 0);
286   assert(transmit_discards >= 0);
287   assert(transmit_errors >= 0);
288
289   if (measurement->errors == NULL)
290   {
291     EVEL_DEBUG("Adding Errors: %d, %d; %d, %d",
292                receive_discards,
293                receive_errors,
294                transmit_discards,
295                transmit_errors);
296     errors = malloc(sizeof(MEASUREMENT_ERRORS));
297     assert(errors != NULL);
298     memset(errors, 0, sizeof(MEASUREMENT_ERRORS));
299     errors->receive_discards = receive_discards;
300     errors->receive_errors = receive_errors;
301     errors->transmit_discards = transmit_discards;
302     errors->transmit_errors = transmit_errors;
303     measurement->errors = errors;
304   }
305   else
306   {
307     errors = measurement->errors;
308     EVEL_DEBUG("Ignoring attempt to add Errors: %d, %d; %d, %d\n"
309                "Errors already set: %d, %d; %d, %d",
310                receive_discards,
311                receive_errors,
312                transmit_discards,
313                transmit_errors,
314                errors->receive_discards,
315                errors->receive_errors,
316                errors->transmit_discards,
317                errors->transmit_errors);
318   }
319
320   EVEL_EXIT();
321 }
322
323 /**************************************************************************//**
324  * Set the Mean Request Latency property of the Measurement.
325  *
326  * @note  The property is treated as immutable: it is only valid to call
327  *        the setter once.  However, we don't assert if the caller tries to
328  *        overwrite, just ignoring the update instead.
329  *
330  * @param measurement          Pointer to the Measurement.
331  * @param mean_request_latency The Mean Request Latency to be set.
332  *****************************************************************************/
333 void evel_measurement_mean_req_lat_set(EVENT_MEASUREMENT * measurement,
334                                        double mean_request_latency)
335 {
336   EVEL_ENTER();
337
338   /***************************************************************************/
339   /* Check preconditions.                                                    */
340   /***************************************************************************/
341   assert(measurement != NULL);
342   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
343   assert(mean_request_latency >= 0.0);
344
345   evel_set_option_double(&measurement->mean_request_latency,
346                          mean_request_latency,
347                          "Mean Request Latency");
348   EVEL_EXIT();
349 }
350
351
352 /**************************************************************************//**
353  * Set the Request Rate property of the Measurement.
354  *
355  * @note  The property is treated as immutable: it is only valid to call
356  *        the setter once.  However, we don't assert if the caller tries to
357  *        overwrite, just ignoring the update instead.
358  *
359  * @param measurement  Pointer to the Measurement.
360  * @param request_rate The Request Rate to be set.
361  *****************************************************************************/
362 void evel_measurement_request_rate_set(EVENT_MEASUREMENT * measurement,
363                                        int request_rate)
364 {
365   EVEL_ENTER();
366
367   /***************************************************************************/
368   /* Check preconditions.                                                    */
369   /***************************************************************************/
370   assert(measurement != NULL);
371   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
372   assert(request_rate >= 0);
373
374   evel_set_option_int(&measurement->request_rate,
375                       request_rate,
376                       "Request Rate");
377   EVEL_EXIT();
378 }
379
380 /**************************************************************************//**
381  * Add an additional CPU usage value name/value pair to the Measurement.
382  *
383  * The name and value are null delimited ASCII strings.  The library takes
384  * a copy so the caller does not have to preserve values after the function
385  * returns.
386  *
387  * @param measurement   Pointer to the measurement.
388  * @param id            ASCIIZ string with the CPU's identifier.
389  * @param usage         CPU utilization.
390  *****************************************************************************/
391 MEASUREMENT_CPU_USE *evel_measurement_new_cpu_use_add(EVENT_MEASUREMENT * measurement,
392                                  char * id, double usage)
393 {
394   MEASUREMENT_CPU_USE * cpu_use = NULL;
395   EVEL_ENTER();
396
397   /***************************************************************************/
398   /* Check assumptions.                                                      */
399   /***************************************************************************/
400   assert(measurement != NULL);
401   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
402   assert(id != NULL);
403   assert(usage >= 0.0);
404
405   /***************************************************************************/
406   /* Allocate a container for the value and push onto the list.              */
407   /***************************************************************************/
408   EVEL_DEBUG("Adding id=%s usage=%lf", id, usage);
409   cpu_use = malloc(sizeof(MEASUREMENT_CPU_USE));
410   assert(cpu_use != NULL);
411   memset(cpu_use, 0, sizeof(MEASUREMENT_CPU_USE));
412   cpu_use->id    = strdup(id);
413   cpu_use->usage = usage;
414   evel_init_option_double(&cpu_use->idle);
415   evel_init_option_double(&cpu_use->intrpt);
416   evel_init_option_double(&cpu_use->nice);
417   evel_init_option_double(&cpu_use->softirq);
418   evel_init_option_double(&cpu_use->steal);
419   evel_init_option_double(&cpu_use->sys);
420   evel_init_option_double(&cpu_use->user);
421   evel_init_option_double(&cpu_use->wait);
422
423   dlist_push_last(&measurement->cpu_usage, cpu_use);
424
425   EVEL_EXIT();
426   return cpu_use;
427 }
428
429 /**************************************************************************//**
430  * Set the CPU Idle value in measurement interval
431  *   percentage of CPU time spent in the idle task
432  *
433  * @note  The property is treated as immutable: it is only valid to call
434  *        the setter once.  However, we don't assert if the caller tries to
435  *        overwrite, just ignoring the update instead.
436  *
437  * @param cpu_use      Pointer to the CPU Use.
438  * @param val          double
439  *****************************************************************************/
440 void evel_measurement_cpu_use_idle_set(MEASUREMENT_CPU_USE *const cpu_use,
441                                     const double val)
442 {
443   EVEL_ENTER();
444   evel_set_option_double(&cpu_use->idle, val, "CPU idle time");
445   EVEL_EXIT();
446 }
447
448 /**************************************************************************//**
449  * Set the percentage of time spent servicing interrupts
450  *
451  * @note  The property is treated as immutable: it is only valid to call
452  *        the setter once.  However, we don't assert if the caller tries to
453  *        overwrite, just ignoring the update instead.
454  *
455  * @param cpu_use      Pointer to the CPU Use.
456  * @param val          double
457  *****************************************************************************/
458 void evel_measurement_cpu_use_interrupt_set(MEASUREMENT_CPU_USE * const cpu_use,
459                                     const double val)
460 {
461   EVEL_ENTER();
462   evel_set_option_double(&cpu_use->intrpt, val, "CPU interrupt value");
463   EVEL_EXIT();
464 }
465
466
467 /**************************************************************************//**
468  * Set the percentage of time spent running user space processes that have been niced
469  *
470  * @note  The property is treated as immutable: it is only valid to call
471  *        the setter once.  However, we don't assert if the caller tries to
472  *        overwrite, just ignoring the update instead.
473  *
474  * @param cpu_use      Pointer to the CPU Use.
475  * @param val          double
476  *****************************************************************************/
477 void evel_measurement_cpu_use_nice_set(MEASUREMENT_CPU_USE * const cpu_use,
478                                     const double val)
479 {
480   EVEL_ENTER();
481   evel_set_option_double(&cpu_use->nice, val, "CPU nice value");
482   EVEL_EXIT();
483 }
484
485
486 /**************************************************************************//**
487  * Set the percentage of time spent handling soft irq interrupts
488  *
489  * @note  The property is treated as immutable: it is only valid to call
490  *        the setter once.  However, we don't assert if the caller tries to
491  *        overwrite, just ignoring the update instead.
492  *
493  * @param cpu_use      Pointer to the CPU Use.
494  * @param val          double
495  *****************************************************************************/
496 void evel_measurement_cpu_use_softirq_set(MEASUREMENT_CPU_USE * const cpu_use,
497                                     const double val)
498 {
499   EVEL_ENTER();
500   evel_set_option_double(&cpu_use->softirq, val, "CPU Soft IRQ value");
501   EVEL_EXIT();
502 }
503
504 /**************************************************************************//**
505  * Set the percentage of time spent in involuntary wait
506  *
507  * @note  The property is treated as immutable: it is only valid to call
508  *        the setter once.  However, we don't assert if the caller tries to
509  *        overwrite, just ignoring the update instead.
510  *
511  * @param cpu_use      Pointer to the CPU Use.
512  * @param val          double
513  *****************************************************************************/
514 void evel_measurement_cpu_use_steal_set(MEASUREMENT_CPU_USE * const cpu_use,
515                                     const double val)
516 {
517   EVEL_ENTER();
518   evel_set_option_double(&cpu_use->steal, val, "CPU involuntary wait");
519   EVEL_EXIT();
520 }
521
522 /**************************************************************************//**
523  * Set the percentage of time spent on system tasks running the kernel
524  *
525  * @note  The property is treated as immutable: it is only valid to call
526  *        the setter once.  However, we don't assert if the caller tries to
527  *        overwrite, just ignoring the update instead.
528  *
529  * @param cpu_use      Pointer to the CPU Use.
530  * @param val          double
531  *****************************************************************************/
532 void evel_measurement_cpu_use_system_set(MEASUREMENT_CPU_USE * const cpu_use,
533                                     const double val)
534 {
535   EVEL_ENTER();
536   evel_set_option_double(&cpu_use->sys, val, "CPU System load");
537   EVEL_EXIT();
538 }
539
540
541 /**************************************************************************//**
542  * Set the percentage of time spent running un-niced user space processes
543  *
544  * @note  The property is treated as immutable: it is only valid to call
545  *        the setter once.  However, we don't assert if the caller tries to
546  *        overwrite, just ignoring the update instead.
547  *
548  * @param cpu_use      Pointer to the CPU Use.
549  * @param val          double
550  *****************************************************************************/
551 void evel_measurement_cpu_use_usageuser_set(MEASUREMENT_CPU_USE * const cpu_use,
552                                     const double val)
553 {
554   EVEL_ENTER();
555   evel_set_option_double(&cpu_use->user, val, "CPU User load value");
556   EVEL_EXIT();
557 }
558
559 /**************************************************************************//**
560  * Set the percentage of CPU time spent waiting for I/O operations to complete
561  *
562  * @note  The property is treated as immutable: it is only valid to call
563  *        the setter once.  However, we don't assert if the caller tries to
564  *        overwrite, just ignoring the update instead.
565  *
566  * @param cpu_use      Pointer to the CPU Use.
567  * @param val          double
568  *****************************************************************************/
569 void evel_measurement_cpu_use_wait_set(MEASUREMENT_CPU_USE * const cpu_use,
570                                     const double val)
571 {
572   EVEL_ENTER();
573   evel_set_option_double(&cpu_use->wait, val, "CPU Wait IO value");
574   EVEL_EXIT();
575 }
576
577
578 /**************************************************************************//**
579  * Add an additional Memory usage value name/value pair to the Measurement.
580  *
581  * The name and value are null delimited ASCII strings.  The library takes
582  * a copy so the caller does not have to preserve values after the function
583  * returns.
584  *
585  * @param measurement   Pointer to the measurement.
586  * @param id            ASCIIZ string with the Memory identifier.
587  * @param vmidentifier  ASCIIZ string with the VM's identifier.
588  * @param membuffsz     Memory Size.
589  *
590  * @return  Returns pointer to memory use structure in measurements
591  *****************************************************************************/
592 MEASUREMENT_MEM_USE * evel_measurement_new_mem_use_add(EVENT_MEASUREMENT * measurement,
593                                  char * id,  char *vmidentifier,  double membuffsz)
594 {
595   MEASUREMENT_MEM_USE * mem_use = NULL;
596   EVEL_ENTER();
597
598   /***************************************************************************/
599   /* Check assumptions.                                                      */
600   /***************************************************************************/
601   assert(measurement != NULL);
602   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
603   assert(id != NULL);
604   assert(membuffsz >= 0.0);
605
606   /***************************************************************************/
607   /* Allocate a container for the value and push onto the list.              */
608   /***************************************************************************/
609   EVEL_DEBUG("Adding id=%s buffer size=%lf", id, membuffsz);
610   mem_use = malloc(sizeof(MEASUREMENT_MEM_USE));
611   assert(mem_use != NULL);
612   memset(mem_use, 0, sizeof(MEASUREMENT_MEM_USE));
613   mem_use->id    = strdup(id);
614   mem_use->vmid  = strdup(vmidentifier);
615   mem_use->membuffsz = membuffsz;
616   evel_init_option_double(&mem_use->memcache);
617   evel_init_option_double(&mem_use->memconfig);
618   evel_init_option_double(&mem_use->memfree);
619   evel_init_option_double(&mem_use->slabrecl);
620   evel_init_option_double(&mem_use->slabunrecl);
621   evel_init_option_double(&mem_use->memused);
622
623   assert(mem_use->id != NULL);
624
625   dlist_push_last(&measurement->mem_usage, mem_use);
626
627   EVEL_EXIT();
628   return mem_use;
629 }
630
631 /**************************************************************************//**
632  * Set kilobytes of memory used for cache
633  *
634  * @note  The property is treated as immutable: it is only valid to call
635  *        the setter once.  However, we don't assert if the caller tries to
636  *        overwrite, just ignoring the update instead.
637  *
638  * @param mem_use      Pointer to the Memory Use.
639  * @param val          double
640  *****************************************************************************/
641 void evel_measurement_mem_use_memcache_set(MEASUREMENT_MEM_USE * const mem_use,
642                                     const double val)
643 {
644   EVEL_ENTER();
645   evel_set_option_double(&mem_use->memcache, val, "Memory cache value");
646   EVEL_EXIT();
647 }
648
649 /**************************************************************************//**
650  * Set kilobytes of memory configured in the virtual machine on which the VNFC reporting
651  *
652  * @note  The property is treated as immutable: it is only valid to call
653  *        the setter once.  However, we don't assert if the caller tries to
654  *        overwrite, just ignoring the update instead.
655  *
656  * @param mem_use      Pointer to the Memory Use.
657  * @param val          double
658  *****************************************************************************/
659 void evel_measurement_mem_use_memconfig_set(MEASUREMENT_MEM_USE * const mem_use,
660                                     const double val)
661 {
662   EVEL_ENTER();
663   evel_set_option_double(&mem_use->memconfig, val, "Memory configured value");
664   EVEL_EXIT();
665 }
666
667 /**************************************************************************//**
668  * Set kilobytes of physical RAM left unused by the system
669  *
670  * @note  The property is treated as immutable: it is only valid to call
671  *        the setter once.  However, we don't assert if the caller tries to
672  *        overwrite, just ignoring the update instead.
673  *
674  * @param mem_use      Pointer to the Memory Use.
675  * @param val          double
676  *****************************************************************************/
677 void evel_measurement_mem_use_memfree_set(MEASUREMENT_MEM_USE * const mem_use,
678                                     const double val)
679 {
680   EVEL_ENTER();
681   evel_set_option_double(&mem_use->memfree, val, "Memory freely available value");
682   EVEL_EXIT();
683 }
684
685 /**************************************************************************//**
686  * Set the part of the slab that can be reclaimed such as caches measured in kilobytes
687  *
688  * @note  The property is treated as immutable: it is only valid to call
689  *        the setter once.  However, we don't assert if the caller tries to
690  *        overwrite, just ignoring the update instead.
691  *
692  * @param mem_use      Pointer to the Memory Use.
693  * @param val          double
694  *****************************************************************************/
695 void evel_measurement_mem_use_slab_reclaimed_set(MEASUREMENT_MEM_USE * const mem_use,
696                                     const double val)
697 {
698   EVEL_ENTER();
699   evel_set_option_double(&mem_use->slabrecl, val, "Memory reclaimable slab set");
700   EVEL_EXIT();
701 }
702
703 /**************************************************************************//**
704  * Set the part of the slab that cannot be reclaimed such as caches measured in kilobytes
705  *
706  * @note  The property is treated as immutable: it is only valid to call
707  *        the setter once.  However, we don't assert if the caller tries to
708  *        overwrite, just ignoring the update instead.
709  *
710  * @param mem_use      Pointer to the Memory Use.
711  * @param val          double
712  *****************************************************************************/
713 void evel_measurement_mem_use_slab_unreclaimable_set(MEASUREMENT_MEM_USE * const mem_use,
714                                     const double val)
715 {
716   EVEL_ENTER();
717   evel_set_option_double(&mem_use->slabunrecl, val, "Memory unreclaimable slab set");
718   EVEL_EXIT();
719 }
720
721 /**************************************************************************//**
722  * Set the total memory minus the sum of free, buffered, cached and slab memory in kilobytes
723  *
724  * @note  The property is treated as immutable: it is only valid to call
725  *        the setter once.  However, we don't assert if the caller tries to
726  *        overwrite, just ignoring the update instead.
727  *
728  * @param mem_use      Pointer to the Memory Use.
729  * @param val          double
730  *****************************************************************************/
731 void evel_measurement_mem_use_usedup_set(MEASUREMENT_MEM_USE * const mem_use,
732                                     const double val)
733 {
734   EVEL_ENTER();
735   evel_set_option_double(&mem_use->memused, val, "Memory usedup total set");
736   EVEL_EXIT();
737 }
738
739 /**************************************************************************//**
740  * Add an additional Disk usage value name/value pair to the Measurement.
741  *
742  * The name and value are null delimited ASCII strings.  The library takes
743  * a copy so the caller does not have to preserve values after the function
744  * returns.
745  *
746  * @param measurement   Pointer to the measurement.
747  * @param id            ASCIIZ string with the CPU's identifier.
748  * @param usage         Disk utilization.
749  *****************************************************************************/
750 MEASUREMENT_DISK_USE * evel_measurement_new_disk_use_add(EVENT_MEASUREMENT * measurement, char * id)
751 {
752   MEASUREMENT_DISK_USE * disk_use = NULL;
753   EVEL_ENTER();
754
755   /***************************************************************************/
756   /* Check assumptions.                                                      */
757   /***************************************************************************/
758   assert(measurement != NULL);
759   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
760   assert(id != NULL);
761
762   /***************************************************************************/
763   /* Allocate a container for the value and push onto the list.              */
764   /***************************************************************************/
765   EVEL_DEBUG("Adding id=%s disk usage", id);
766   disk_use = malloc(sizeof(MEASUREMENT_DISK_USE));
767   assert(disk_use != NULL);
768   memset(disk_use, 0, sizeof(MEASUREMENT_DISK_USE));
769   disk_use->id    = strdup(id);
770   assert(disk_use->id != NULL);
771   dlist_push_last(&measurement->disk_usage, disk_use);
772
773   evel_init_option_double(&disk_use->iotimeavg );
774   evel_init_option_double(&disk_use->iotimelast );
775   evel_init_option_double(&disk_use->iotimemax );
776   evel_init_option_double(&disk_use->iotimemin );
777   evel_init_option_double(&disk_use->mergereadavg );
778   evel_init_option_double(&disk_use->mergereadlast );
779   evel_init_option_double(&disk_use->mergereadmax );
780   evel_init_option_double(&disk_use->mergereadmin );
781   evel_init_option_double(&disk_use->mergewriteavg );
782   evel_init_option_double(&disk_use->mergewritelast );
783   evel_init_option_double(&disk_use->mergewritemax );
784   evel_init_option_double(&disk_use->mergewritemin );
785   evel_init_option_double(&disk_use->octetsreadavg );
786   evel_init_option_double(&disk_use->octetsreadlast );
787   evel_init_option_double(&disk_use->octetsreadmax );
788   evel_init_option_double(&disk_use->octetsreadmin );
789   evel_init_option_double(&disk_use->octetswriteavg );
790   evel_init_option_double(&disk_use->octetswritelast );
791   evel_init_option_double(&disk_use->octetswritemax );
792   evel_init_option_double(&disk_use->octetswritemin );
793   evel_init_option_double(&disk_use->opsreadavg );
794   evel_init_option_double(&disk_use->opsreadlast );
795   evel_init_option_double(&disk_use->opsreadmax );
796   evel_init_option_double(&disk_use->opsreadmin );
797   evel_init_option_double(&disk_use->opswriteavg );
798   evel_init_option_double(&disk_use->opswritelast );
799   evel_init_option_double(&disk_use->opswritemax );
800   evel_init_option_double(&disk_use->opswritemin );
801   evel_init_option_double(&disk_use->pendingopsavg );
802   evel_init_option_double(&disk_use->pendingopslast );
803   evel_init_option_double(&disk_use->pendingopsmax );
804   evel_init_option_double(&disk_use->pendingopsmin );
805   evel_init_option_double(&disk_use->timereadavg );
806   evel_init_option_double(&disk_use->timereadlast );
807   evel_init_option_double(&disk_use->timereadmax );
808   evel_init_option_double(&disk_use->timereadmin );
809   evel_init_option_double(&disk_use->timewriteavg );
810   evel_init_option_double(&disk_use->timewritelast );
811   evel_init_option_double(&disk_use->timewritemax );
812   evel_init_option_double(&disk_use->timewritemin );
813
814   EVEL_EXIT();
815   return disk_use;
816 }
817
818 /**************************************************************************//**
819  * Set milliseconds spent doing input/output operations over 1 sec; treat
820  * this metric as a device load percentage where 1000ms  matches 100% load;
821  * provide the average over the measurement interval
822  *
823  * @note  The property is treated as immutable: it is only valid to call
824  *        the setter once.  However, we don't assert if the caller tries to
825  *        overwrite, just ignoring the update instead.
826  *
827  * @param disk_use     Pointer to the Disk Use.
828  * @param val          double
829  *****************************************************************************/
830 void evel_measurement_disk_use_iotimeavg_set(MEASUREMENT_DISK_USE * const disk_use,
831                                     const double val) 
832 {
833   EVEL_ENTER();
834   evel_set_option_double(&disk_use->iotimeavg, val, "Disk ioload set");
835   EVEL_EXIT();
836 }
837
838 /**************************************************************************//**
839  * Set milliseconds spent doing input/output operations over 1 sec; treat
840  * this metric as a device load percentage where 1000ms  matches 100% load;
841  * provide the last value within the measurement interval
842  *
843  * @note  The property is treated as immutable: it is only valid to call
844  *        the setter once.  However, we don't assert if the caller tries to
845  *        overwrite, just ignoring the update instead.
846  *
847  * @param disk_use     Pointer to the Disk Use.
848  * @param val          double
849  *****************************************************************************/
850 void evel_measurement_disk_use_iotimelast_set(MEASUREMENT_DISK_USE * const disk_use,
851                                     const double val)
852 {
853   EVEL_ENTER();
854   evel_set_option_double(&disk_use->iotimelast, val, "Disk ioloadlast set");
855   EVEL_EXIT();
856 }
857
858 /**************************************************************************//**
859  * Set milliseconds spent doing input/output operations over 1 sec; treat
860  * this metric as a device load percentage where 1000ms  matches 100% load;
861  * provide the maximum value within the measurement interval
862  *
863  * @note  The property is treated as immutable: it is only valid to call
864  *        the setter once.  However, we don't assert if the caller tries to
865  *        overwrite, just ignoring the update instead.
866  *
867  * @param disk_use     Pointer to the Disk Use.
868  * @param val          double
869  *****************************************************************************/
870 void evel_measurement_disk_use_iotimemax_set(MEASUREMENT_DISK_USE * const disk_use,
871                                     const double val)
872 {
873   EVEL_ENTER();
874   evel_set_option_double(&disk_use->iotimemax, val, "Disk ioloadmax set");
875   EVEL_EXIT();
876 }
877
878 /**************************************************************************//**
879  * Set milliseconds spent doing input/output operations over 1 sec; treat
880  * this metric as a device load percentage where 1000ms  matches 100% load;
881  * provide the minimum value within the measurement interval
882  *
883  * @note  The property is treated as immutable: it is only valid to call
884  *        the setter once.  However, we don't assert if the caller tries to
885  *        overwrite, just ignoring the update instead.
886  *
887  * @param disk_use     Pointer to the Disk Use.
888  * @param val          double
889  *****************************************************************************/
890 void evel_measurement_disk_use_iotimemin_set(MEASUREMENT_DISK_USE * const disk_use,
891                                     const double val)
892 {
893   EVEL_ENTER();
894   evel_set_option_double(&disk_use->iotimemin, val, "Disk ioloadmin set");
895   EVEL_EXIT();
896 }
897
898 /**************************************************************************//**
899  * Set number of logical read operations that were merged into physical read
900  * operations, e.g., two logical reads were served by one physical disk access;
901  * provide the average measurement within the measurement interval
902  *
903  * @note  The property is treated as immutable: it is only valid to call
904  *        the setter once.  However, we don't assert if the caller tries to
905  *        overwrite, just ignoring the update instead.
906  *
907  * @param disk_use     Pointer to the Disk Use.
908  * @param val          double
909  *****************************************************************************/
910 void evel_measurement_disk_use_mergereadavg_set(MEASUREMENT_DISK_USE * const disk_use,
911                                     const double val)
912 {
913   EVEL_ENTER();
914   evel_set_option_double(&disk_use->mergereadavg, val, "Disk Merged read average set");
915   EVEL_EXIT();
916 }
917 /**************************************************************************//**
918  * Set number of logical read operations that were merged into physical read
919  * operations, e.g., two logical reads were served by one physical disk access;
920  * provide the last measurement within the measurement interval
921  *
922  * @note  The property is treated as immutable: it is only valid to call
923  *        the setter once.  However, we don't assert if the caller tries to
924  *        overwrite, just ignoring the update instead.
925  *
926  * @param disk_use     Pointer to the Disk Use.
927  * @param val          double
928  *****************************************************************************/
929 void evel_measurement_disk_use_mergereadlast_set(MEASUREMENT_DISK_USE * const disk_use,
930                                     const double val)
931 {
932   EVEL_ENTER();
933   evel_set_option_double(&disk_use->mergereadlast, val, "Disk mergedload last set");
934   EVEL_EXIT();
935 }
936 /**************************************************************************//**
937  * Set number of logical read operations that were merged into physical read
938  * operations, e.g., two logical reads were served by one physical disk access;
939  * provide the maximum measurement within the measurement interval
940  *
941  * @note  The property is treated as immutable: it is only valid to call
942  *        the setter once.  However, we don't assert if the caller tries to
943  *        overwrite, just ignoring the update instead.
944  *
945  * @param disk_use     Pointer to the Disk Use.
946  * @param val          double
947  *****************************************************************************/
948 void evel_measurement_disk_use_mergereadmax_set(MEASUREMENT_DISK_USE * const disk_use,
949                                     const double val)
950 {
951   EVEL_ENTER();
952   evel_set_option_double(&disk_use->mergereadmax, val, "Disk merged loadmax set");
953   EVEL_EXIT();
954 }
955
956 /**************************************************************************//**
957  * Set number of logical read operations that were merged into physical read
958  * operations, e.g., two logical reads were served by one physical disk access;
959  * provide the minimum measurement within the measurement interval
960  *
961  * @note  The property is treated as immutable: it is only valid to call
962  *        the setter once.  However, we don't assert if the caller tries to
963  *        overwrite, just ignoring the update instead.
964  *
965  * @param disk_use     Pointer to the Disk Use.
966  * @param val          double
967  *****************************************************************************/
968 void evel_measurement_disk_use_mergereadmin_set(MEASUREMENT_DISK_USE * const disk_use,
969                                     const double val)
970 {
971   EVEL_ENTER();
972   evel_set_option_double(&disk_use->mergereadmin, val, "Disk merged loadmin set");
973   EVEL_EXIT();
974 }
975 /**************************************************************************//**
976  * Set number of logical write operations that were merged into physical read
977  * operations, e.g., two logical writes were served by one physical disk access;
978  * provide the last measurement within the measurement interval
979  *
980  * @note  The property is treated as immutable: it is only valid to call
981  *        the setter once.  However, we don't assert if the caller tries to
982  *        overwrite, just ignoring the update instead.
983  *
984  * @param disk_use     Pointer to the Disk Use.
985  * @param val          double
986  *****************************************************************************/
987 void evel_measurement_disk_use_mergewritelast_set(MEASUREMENT_DISK_USE * const disk_use,
988                                     const double val)
989 {
990   EVEL_ENTER();
991   evel_set_option_double(&disk_use->mergewritelast, val, "Disk merged writelast set");
992   EVEL_EXIT();
993 }
994 /**************************************************************************//**
995  * Set number of logical write operations that were merged into physical read
996  * operations, e.g., two logical writes were served by one physical disk access;
997  * provide the maximum measurement within the measurement interval
998  *
999  * @note  The property is treated as immutable: it is only valid to call
1000  *        the setter once.  However, we don't assert if the caller tries to
1001  *        overwrite, just ignoring the update instead.
1002  *
1003  * @param disk_use     Pointer to the Disk Use.
1004  * @param val          double
1005  *****************************************************************************/
1006 void evel_measurement_disk_use_mergewritemax_set(MEASUREMENT_DISK_USE * const disk_use,
1007                                     const double val)
1008 {
1009   EVEL_ENTER();
1010   evel_set_option_double(&disk_use->mergewritemax, val, "Disk writemax set");
1011   EVEL_EXIT();
1012 }
1013 /**************************************************************************//**
1014  * Set number of logical write operations that were merged into physical read
1015  * operations, e.g., two logical writes were served by one physical disk access;
1016  * provide the average measurement within the measurement interval
1017  *
1018  * @note  The property is treated as immutable: it is only valid to call
1019  *        the setter once.  However, we don't assert if the caller tries to
1020  *        overwrite, just ignoring the update instead.
1021  *
1022  * @param disk_use     Pointer to the Disk Use.
1023  * @param val          double
1024  *****************************************************************************/
1025 void evel_measurement_disk_use_mergewriteavg_set(MEASUREMENT_DISK_USE * const disk_use,
1026                                     const double val)
1027 {
1028   EVEL_ENTER();
1029   evel_set_option_double(&disk_use->mergewriteavg, val, "Disk writeavg set");
1030   EVEL_EXIT();
1031 }
1032 /**************************************************************************//**
1033  * Set number of logical write operations that were merged into physical read
1034  * operations, e.g., two logical writes were served by one physical disk access;
1035  * provide the maximum measurement within the measurement interval
1036  *
1037  * @note  The property is treated as immutable: it is only valid to call
1038  *        the setter once.  However, we don't assert if the caller tries to
1039  *        overwrite, just ignoring the update instead.
1040  *
1041  * @param disk_use     Pointer to the Disk Use.
1042  * @param val          double
1043  *****************************************************************************/
1044 void evel_measurement_disk_use_mergewritemin_set(MEASUREMENT_DISK_USE * const disk_use,
1045                                     const double val)
1046 {
1047   EVEL_ENTER();
1048   evel_set_option_double(&disk_use->mergewritemin, val, "Disk writemin set");
1049   EVEL_EXIT();
1050 }
1051
1052 /**************************************************************************//**
1053  * Set number of octets per second read from a disk or partition;
1054  * provide the average measurement within the measurement interval
1055  *
1056  * @note  The property is treated as immutable: it is only valid to call
1057  *        the setter once.  However, we don't assert if the caller tries to
1058  *        overwrite, just ignoring the update instead.
1059  *
1060  * @param disk_use     Pointer to the Disk Use.
1061  * @param val          double
1062  *****************************************************************************/
1063 void evel_measurement_disk_use_octetsreadavg_set(MEASUREMENT_DISK_USE * const disk_use,
1064                                     const double val)
1065 {
1066   EVEL_ENTER();
1067   evel_set_option_double(&disk_use->octetsreadavg, val, "Octets readavg set");
1068   EVEL_EXIT();
1069 }
1070
1071 /**************************************************************************//**
1072  * Set number of octets per second read from a disk or partition;
1073  * provide the last measurement within the measurement interval
1074  *
1075  * @note  The property is treated as immutable: it is only valid to call
1076  *        the setter once.  However, we don't assert if the caller tries to
1077  *        overwrite, just ignoring the update instead.
1078  *
1079  * @param disk_use     Pointer to the Disk Use.
1080  * @param val          double
1081  *****************************************************************************/
1082 void evel_measurement_disk_use_octetsreadlast_set(MEASUREMENT_DISK_USE * const disk_use,
1083                                     const double val)
1084 {
1085   EVEL_ENTER();
1086   evel_set_option_double(&disk_use->octetsreadlast, val, "Octets readlast set");
1087   EVEL_EXIT();
1088 }
1089
1090 /**************************************************************************//**
1091  * Set number of octets per second read from a disk or partition;
1092  * provide the maximum measurement within the measurement interval
1093  *
1094  * @note  The property is treated as immutable: it is only valid to call
1095  *        the setter once.  However, we don't assert if the caller tries to
1096  *        overwrite, just ignoring the update instead.
1097  *
1098  * @param disk_use     Pointer to the Disk Use.
1099  * @param val          double
1100  *****************************************************************************/
1101 void evel_measurement_disk_use_octetsreadmax_set(MEASUREMENT_DISK_USE * const disk_use,
1102                                     const double val)
1103 {
1104   EVEL_ENTER();
1105   evel_set_option_double(&disk_use->octetsreadmax, val, "Octets readmax set");
1106   EVEL_EXIT();
1107 }
1108 /**************************************************************************//**
1109  * Set number of octets per second read from a disk or partition;
1110  * provide the minimum measurement within the measurement interval
1111  *
1112  * @note  The property is treated as immutable: it is only valid to call
1113  *        the setter once.  However, we don't assert if the caller tries to
1114  *        overwrite, just ignoring the update instead.
1115  *
1116  * @param disk_use     Pointer to the Disk Use.
1117  * @param val          double
1118  *****************************************************************************/
1119 void evel_measurement_disk_use_octetsreadmin_set(MEASUREMENT_DISK_USE * const disk_use,
1120                                     const double val)
1121 {
1122   EVEL_ENTER();
1123   evel_set_option_double(&disk_use->octetsreadmin, val, "Octets readmin set");
1124   EVEL_EXIT();
1125 }
1126 /**************************************************************************//**
1127  * Set number of octets per second written to a disk or partition;
1128  * provide the average measurement within the measurement interval
1129  *
1130  * @note  The property is treated as immutable: it is only valid to call
1131  *        the setter once.  However, we don't assert if the caller tries to
1132  *        overwrite, just ignoring the update instead.
1133  *
1134  * @param disk_use     Pointer to the Disk Use.
1135  * @param val          double
1136  *****************************************************************************/
1137 void evel_measurement_disk_use_octetswriteavg_set(MEASUREMENT_DISK_USE * const disk_use,
1138                                     const double val)
1139 {
1140   EVEL_ENTER();
1141   evel_set_option_double(&disk_use->octetswriteavg, val, "Octets writeavg set");
1142   EVEL_EXIT();
1143 }
1144 /**************************************************************************//**
1145  * Set number of octets per second written to a disk or partition;
1146  * provide the last measurement within the measurement interval
1147  *
1148  * @note  The property is treated as immutable: it is only valid to call
1149  *        the setter once.  However, we don't assert if the caller tries to
1150  *        overwrite, just ignoring the update instead.
1151  *
1152  * @param disk_use     Pointer to the Disk Use.
1153  * @param val          double
1154  *****************************************************************************/
1155 void evel_measurement_disk_use_octetswritelast_set(MEASUREMENT_DISK_USE * const disk_use,
1156                                     const double val)
1157 {
1158   EVEL_ENTER();
1159   evel_set_option_double(&disk_use->octetswritelast, val, "Octets writelast set");
1160   EVEL_EXIT();
1161 }
1162 /**************************************************************************//**
1163  * Set number of octets per second written to a disk or partition;
1164  * provide the maximum measurement within the measurement interval
1165  *
1166  * @note  The property is treated as immutable: it is only valid to call
1167  *        the setter once.  However, we don't assert if the caller tries to
1168  *        overwrite, just ignoring the update instead.
1169  *
1170  * @param disk_use     Pointer to the Disk Use.
1171  * @param val          double
1172  *****************************************************************************/
1173 void evel_measurement_disk_use_octetswritemax_set(MEASUREMENT_DISK_USE * const disk_use,
1174                                     const double val)
1175 {
1176   EVEL_ENTER();
1177   evel_set_option_double(&disk_use->octetswritemax, val, "Octets writemax set");
1178   EVEL_EXIT();
1179 }
1180 /**************************************************************************//**
1181  * Set number of octets per second written to a disk or partition;
1182  * provide the minimum measurement within the measurement interval
1183  *
1184  * @note  The property is treated as immutable: it is only valid to call
1185  *        the setter once.  However, we don't assert if the caller tries to
1186  *        overwrite, just ignoring the update instead.
1187  *
1188  * @param disk_use     Pointer to the Disk Use.
1189  * @param val          double
1190  *****************************************************************************/
1191 void evel_measurement_disk_use_octetswritemin_set(MEASUREMENT_DISK_USE * const disk_use,
1192                                     const double val)
1193 {
1194   EVEL_ENTER();
1195   evel_set_option_double(&disk_use->octetswritemin, val, "Octets writemin set");
1196   EVEL_EXIT();
1197 }
1198
1199 /**************************************************************************//**
1200  * Set number of read operations per second issued to the disk;
1201  * provide the average measurement within the measurement interval
1202  *
1203  * @note  The property is treated as immutable: it is only valid to call
1204  *        the setter once.  However, we don't assert if the caller tries to
1205  *        overwrite, just ignoring the update instead.
1206  *
1207  * @param disk_use     Pointer to the Disk Use.
1208  * @param val          double
1209  *****************************************************************************/
1210 void evel_measurement_disk_use_opsreadavg_set(MEASUREMENT_DISK_USE * const disk_use,
1211                                     const double val)
1212 {
1213   EVEL_ENTER();
1214   evel_set_option_double(&disk_use->opsreadavg, val, "Disk read operation average set");
1215   EVEL_EXIT();
1216 }
1217 /**************************************************************************//**
1218  * Set number of read operations per second issued to the disk;
1219  * provide the last measurement within the measurement interval
1220  *
1221  * @note  The property is treated as immutable: it is only valid to call
1222  *        the setter once.  However, we don't assert if the caller tries to
1223  *        overwrite, just ignoring the update instead.
1224  *
1225  * @param disk_use     Pointer to the Disk Use.
1226  * @param val          double
1227  *****************************************************************************/
1228 void evel_measurement_disk_use_opsreadlast_set(MEASUREMENT_DISK_USE * const disk_use,
1229                                     const double val)
1230 {
1231   EVEL_ENTER();
1232   evel_set_option_double(&disk_use->opsreadlast, val, "Disk read operation last set");
1233   EVEL_EXIT();
1234 }
1235 /**************************************************************************//**
1236  * Set number of read operations per second issued to the disk;
1237  * provide the maximum measurement within the measurement interval
1238  *
1239  * @note  The property is treated as immutable: it is only valid to call
1240  *        the setter once.  However, we don't assert if the caller tries to
1241  *        overwrite, just ignoring the update instead.
1242  *
1243  * @param disk_use     Pointer to the Disk Use.
1244  * @param val          double
1245  *****************************************************************************/
1246 void evel_measurement_disk_use_opsreadmax_set(MEASUREMENT_DISK_USE * const disk_use,
1247                                     const double val)
1248 {
1249   EVEL_ENTER();
1250   evel_set_option_double(&disk_use->opsreadmax, val, "Disk read operation maximum set");
1251   EVEL_EXIT();
1252 }
1253 /**************************************************************************//**
1254  * Set number of read operations per second issued to the disk;
1255  * provide the minimum measurement within the measurement interval
1256  *
1257  * @note  The property is treated as immutable: it is only valid to call
1258  *        the setter once.  However, we don't assert if the caller tries to
1259  *        overwrite, just ignoring the update instead.
1260  *
1261  * @param disk_use     Pointer to the Disk Use.
1262  * @param val          double
1263  *****************************************************************************/
1264 void evel_measurement_disk_use_opsreadmin_set(MEASUREMENT_DISK_USE * const disk_use,
1265                                     const double val)
1266 {
1267   EVEL_ENTER();
1268   evel_set_option_double(&disk_use->opsreadmin, val, "Disk read operation minimum set");
1269   EVEL_EXIT();
1270 }
1271 /**************************************************************************//**
1272  * Set number of write operations per second issued to the disk;
1273  * provide the average measurement within the measurement interval
1274  *
1275  * @note  The property is treated as immutable: it is only valid to call
1276  *        the setter once.  However, we don't assert if the caller tries to
1277  *        overwrite, just ignoring the update instead.
1278  *
1279  * @param disk_use     Pointer to the Disk Use.
1280  * @param val          double
1281  *****************************************************************************/
1282 void evel_measurement_disk_use_opswriteavg_set(MEASUREMENT_DISK_USE * const disk_use,
1283                                     const double val)
1284 {
1285   EVEL_ENTER();
1286   evel_set_option_double(&disk_use->opswriteavg, val, "Disk write operation average set");
1287   EVEL_EXIT();
1288 }
1289 /**************************************************************************//**
1290  * Set number of write operations per second issued to the disk;
1291  * provide the last measurement within the measurement interval
1292  *
1293  * @note  The property is treated as immutable: it is only valid to call
1294  *        the setter once.  However, we don't assert if the caller tries to
1295  *        overwrite, just ignoring the update instead.
1296  *
1297  * @param disk_use     Pointer to the Disk Use.
1298  * @param val          double
1299  *****************************************************************************/
1300 void evel_measurement_disk_use_opswritelast_set(MEASUREMENT_DISK_USE * const disk_use,
1301                                     const double val)
1302 {
1303   EVEL_ENTER();
1304   evel_set_option_double(&disk_use->opswritelast, val, "Disk write operation last set");
1305   EVEL_EXIT();
1306 }
1307
1308 /**************************************************************************//**
1309  * Set number of write operations per second issued to the disk;
1310  * provide the maximum measurement within the measurement interval
1311  *
1312  * @note  The property is treated as immutable: it is only valid to call
1313  *        the setter once.  However, we don't assert if the caller tries to
1314  *        overwrite, just ignoring the update instead.
1315  *
1316  * @param disk_use     Pointer to the Disk Use.
1317  * @param val          double
1318  *****************************************************************************/
1319 void evel_measurement_disk_use_opswritemax_set(MEASUREMENT_DISK_USE * const disk_use,
1320                                     const double val)
1321 {
1322   EVEL_ENTER();
1323   evel_set_option_double(&disk_use->opswritemax, val, "Disk write operation maximum set");
1324   EVEL_EXIT();
1325 }
1326 /**************************************************************************//**
1327  * Set number of write operations per second issued to the disk;
1328  * provide the average measurement within the measurement interval
1329  *
1330  * @note  The property is treated as immutable: it is only valid to call
1331  *        the setter once.  However, we don't assert if the caller tries to
1332  *        overwrite, just ignoring the update instead.
1333  *
1334  * @param disk_use     Pointer to the Disk Use.
1335  * @param val          double
1336  *****************************************************************************/
1337 void evel_measurement_disk_use_opswritemin_set(MEASUREMENT_DISK_USE * const disk_use,
1338                                     const double val)
1339 {
1340   EVEL_ENTER();
1341   evel_set_option_double(&disk_use->opswritemin, val, "Disk write operation minimum set");
1342   EVEL_EXIT();
1343 }
1344
1345 /**************************************************************************//**
1346  * Set queue size of pending I/O operations per second;
1347  * provide the average measurement within the measurement interval
1348  *
1349  * @note  The property is treated as immutable: it is only valid to call
1350  *        the setter once.  However, we don't assert if the caller tries to
1351  *        overwrite, just ignoring the update instead.
1352  *
1353  * @param disk_use     Pointer to the Disk Use.
1354  * @param val          double
1355  *****************************************************************************/
1356 void evel_measurement_disk_use_pendingopsavg_set(MEASUREMENT_DISK_USE * const disk_use,
1357                                     const double val)
1358 {
1359   EVEL_ENTER();
1360   evel_set_option_double(&disk_use->pendingopsavg, val, "Disk pending operation average set");
1361   EVEL_EXIT();
1362 }
1363 /**************************************************************************//**
1364  * Set queue size of pending I/O operations per second;
1365  * provide the last measurement within the measurement interval
1366  *
1367  * @note  The property is treated as immutable: it is only valid to call
1368  *        the setter once.  However, we don't assert if the caller tries to
1369  *        overwrite, just ignoring the update instead.
1370  *
1371  * @param disk_use     Pointer to the Disk Use.
1372  * @param val          double
1373  *****************************************************************************/
1374 void evel_measurement_disk_use_pendingopslast_set(MEASUREMENT_DISK_USE * const disk_use,
1375                                     const double val)
1376 {
1377   EVEL_ENTER();
1378   evel_set_option_double(&disk_use->pendingopslast, val, "Disk pending operation last set");
1379   EVEL_EXIT();
1380 }
1381 /**************************************************************************//**
1382  * Set queue size of pending I/O operations per second;
1383  * provide the maximum measurement within the measurement interval
1384  *
1385  * @note  The property is treated as immutable: it is only valid to call
1386  *        the setter once.  However, we don't assert if the caller tries to
1387  *        overwrite, just ignoring the update instead.
1388  *
1389  * @param disk_use     Pointer to the Disk Use.
1390  * @param val          double
1391  *****************************************************************************/
1392 void evel_measurement_disk_use_pendingopsmax_set(MEASUREMENT_DISK_USE * const disk_use,
1393                                     const double val)
1394 {
1395   EVEL_ENTER();
1396   evel_set_option_double(&disk_use->pendingopsmax, val, "Disk pending operation maximum set");
1397   EVEL_EXIT();
1398 }
1399 /**************************************************************************//**
1400  * Set queue size of pending I/O operations per second;
1401  * provide the minimum measurement within the measurement interval
1402  *
1403  * @note  The property is treated as immutable: it is only valid to call
1404  *        the setter once.  However, we don't assert if the caller tries to
1405  *        overwrite, just ignoring the update instead.
1406  *
1407  * @param disk_use     Pointer to the Disk Use.
1408  * @param val          double
1409  *****************************************************************************/
1410 void evel_measurement_disk_use_pendingopsmin_set(MEASUREMENT_DISK_USE * const disk_use,
1411                                     const double val)
1412 {
1413   EVEL_ENTER();
1414   evel_set_option_double(&disk_use->pendingopsmin, val, "Disk pending operation min set");
1415   EVEL_EXIT();
1416 }
1417
1418 /**************************************************************************//**
1419  * Set milliseconds a read operation took to complete;
1420  * provide the average measurement within the measurement interval
1421  *
1422  * @note  The property is treated as immutable: it is only valid to call
1423  *        the setter once.  However, we don't assert if the caller tries to
1424  *        overwrite, just ignoring the update instead.
1425  *
1426  * @param disk_use     Pointer to the Disk Use.
1427  * @param val          double
1428  *****************************************************************************/
1429 void evel_measurement_disk_use_timereadavg_set(MEASUREMENT_DISK_USE * const disk_use,
1430                                     const double val)
1431 {
1432   EVEL_ENTER();
1433   evel_set_option_double(&disk_use->timereadavg, val, "Disk read time average set");
1434   EVEL_EXIT();
1435 }
1436 /**************************************************************************//**
1437  * Set milliseconds a read operation took to complete;
1438  * provide the last measurement within the measurement interval
1439  *
1440  * @note  The property is treated as immutable: it is only valid to call
1441  *        the setter once.  However, we don't assert if the caller tries to
1442  *        overwrite, just ignoring the update instead.
1443  *
1444  * @param disk_use     Pointer to the Disk Use.
1445  * @param val          double
1446  *****************************************************************************/
1447 void evel_measurement_disk_use_timereadlast_set(MEASUREMENT_DISK_USE * const disk_use,
1448                                     const double val)
1449 {
1450   EVEL_ENTER();
1451   evel_set_option_double(&disk_use->timereadlast, val, "Disk read time last set");
1452   EVEL_EXIT();
1453 }
1454 /**************************************************************************//**
1455  * Set milliseconds a read operation took to complete;
1456  * provide the maximum measurement within the measurement interval
1457  *
1458  * @note  The property is treated as immutable: it is only valid to call
1459  *        the setter once.  However, we don't assert if the caller tries to
1460  *        overwrite, just ignoring the update instead.
1461  *
1462  * @param disk_use     Pointer to the Disk Use.
1463  * @param val          double
1464  *****************************************************************************/
1465 void evel_measurement_disk_use_timereadmax_set(MEASUREMENT_DISK_USE * const disk_use,
1466                                     const double val)
1467 {
1468   EVEL_ENTER();
1469   evel_set_option_double(&disk_use->timereadmax, val, "Disk read time maximum set");
1470   EVEL_EXIT();
1471 }
1472 /**************************************************************************//**
1473  * Set milliseconds a read operation took to complete;
1474  * provide the minimum measurement within the measurement interval
1475  *
1476  * @note  The property is treated as immutable: it is only valid to call
1477  *        the setter once.  However, we don't assert if the caller tries to
1478  *        overwrite, just ignoring the update instead.
1479  *
1480  * @param disk_use     Pointer to the Disk Use.
1481  * @param val          double
1482  *****************************************************************************/
1483 void evel_measurement_disk_use_timereadmin_set(MEASUREMENT_DISK_USE * const disk_use,
1484                                     const double val)
1485 {
1486   EVEL_ENTER();
1487   evel_set_option_double(&disk_use->timereadmin, val, "Disk read time minimum set");
1488   EVEL_EXIT();
1489 }
1490 /**************************************************************************//**
1491  * Set milliseconds a write operation took to complete;
1492  * provide the average measurement within the measurement interval
1493  *
1494  * @note  The property is treated as immutable: it is only valid to call
1495  *        the setter once.  However, we don't assert if the caller tries to
1496  *        overwrite, just ignoring the update instead.
1497  *
1498  * @param disk_use     Pointer to the Disk Use.
1499  * @param val          double
1500  *****************************************************************************/
1501 void evel_measurement_disk_use_timewriteavg_set(MEASUREMENT_DISK_USE * const disk_use,
1502                                     const double val)
1503 {
1504   EVEL_ENTER();
1505   evel_set_option_double(&disk_use->timewriteavg, val, "Disk write time average set");
1506   EVEL_EXIT();
1507 }
1508
1509 /**************************************************************************//**
1510  * Set milliseconds a write operation took to complete;
1511  * provide the last measurement within the measurement interval
1512  *
1513  * @note  The property is treated as immutable: it is only valid to call
1514  *        the setter once.  However, we don't assert if the caller tries to
1515  *        overwrite, just ignoring the update instead.
1516  *
1517  * @param disk_use     Pointer to the Disk Use.
1518  * @param val          double
1519  *****************************************************************************/
1520 void evel_measurement_disk_use_timewritelast_set(MEASUREMENT_DISK_USE * const disk_use,
1521                                     const double val)
1522 {
1523   EVEL_ENTER();
1524   evel_set_option_double(&disk_use->timewritelast, val, "Disk write time last set");
1525   EVEL_EXIT();
1526 }
1527 /**************************************************************************//**
1528  * Set milliseconds a write operation took to complete;
1529  * provide the maximum measurement within the measurement interval
1530  *
1531  * @note  The property is treated as immutable: it is only valid to call
1532  *        the setter once.  However, we don't assert if the caller tries to
1533  *        overwrite, just ignoring the update instead.
1534  *
1535  * @param disk_use     Pointer to the Disk Use.
1536  * @param val          double
1537  *****************************************************************************/
1538 void evel_measurement_disk_use_timewritemax_set(MEASUREMENT_DISK_USE * const disk_use,
1539                                     const double val)
1540 {
1541   EVEL_ENTER();
1542   evel_set_option_double(&disk_use->timewritemax, val, "Disk write time max set");
1543   EVEL_EXIT();
1544 }
1545 /**************************************************************************//**
1546  * Set milliseconds a write operation took to complete;
1547  * provide the average measurement within the measurement interval
1548  *
1549  * @note  The property is treated as immutable: it is only valid to call
1550  *        the setter once.  However, we don't assert if the caller tries to
1551  *        overwrite, just ignoring the update instead.
1552  *
1553  * @param disk_use     Pointer to the Disk Use.
1554  * @param val          double
1555  *****************************************************************************/
1556 void evel_measurement_disk_use_timewritemin_set(MEASUREMENT_DISK_USE * const disk_use,
1557                                     const double val)
1558 {
1559   EVEL_ENTER();
1560   evel_set_option_double(&disk_use->timewritemin, val, "Disk write time min set");
1561   EVEL_EXIT();
1562 }
1563
1564 /**************************************************************************//**
1565  * Add an additional File System usage value name/value pair to the
1566  * Measurement.
1567  *
1568  * The filesystem_name is null delimited ASCII string.  The library takes a
1569  * copy so the caller does not have to preserve values after the function
1570  * returns.
1571  *
1572  * @param measurement     Pointer to the measurement.
1573  * @param filesystem_name   ASCIIZ string with the file-system's UUID.
1574  * @param block_configured  Block storage configured.
1575  * @param block_used        Block storage in use.
1576  * @param block_iops        Block storage IOPS.
1577  * @param ephemeral_configured  Ephemeral storage configured.
1578  * @param ephemeral_used        Ephemeral storage in use.
1579  * @param ephemeral_iops        Ephemeral storage IOPS.
1580  *****************************************************************************/
1581 void evel_measurement_fsys_use_add(EVENT_MEASUREMENT * measurement,
1582                                    char * filesystem_name,
1583                                    double block_configured,
1584                                    double block_used,
1585                                    double block_iops,
1586                                    double ephemeral_configured,
1587                                    double ephemeral_used,
1588                                    double ephemeral_iops)
1589 {
1590   MEASUREMENT_FSYS_USE * fsys_use = NULL;
1591   EVEL_ENTER();
1592
1593   /***************************************************************************/
1594   /* Check assumptions.                                                      */
1595   /***************************************************************************/
1596   assert(measurement != NULL);
1597   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1598   assert(filesystem_name != NULL);
1599   assert(block_configured >= 0.0);
1600   assert(block_used >= 0.0);
1601   assert(block_iops >= 0.0);
1602   assert(ephemeral_configured >= 0.0);
1603   assert(ephemeral_used >= 0.0);
1604   assert(ephemeral_iops >= 0.0);
1605
1606   /***************************************************************************/
1607   /* Allocate a container for the value and push onto the list.              */
1608   /***************************************************************************/
1609   EVEL_DEBUG("Adding filesystem_name=%s", filesystem_name);
1610   fsys_use = malloc(sizeof(MEASUREMENT_FSYS_USE));
1611   assert(fsys_use != NULL);
1612   memset(fsys_use, 0, sizeof(MEASUREMENT_FSYS_USE));
1613   fsys_use->filesystem_name = strdup(filesystem_name);
1614   fsys_use->block_configured = block_configured;
1615   fsys_use->block_used = block_used;
1616   fsys_use->block_iops = block_iops;
1617   fsys_use->ephemeral_configured = ephemeral_configured;
1618   fsys_use->ephemeral_used = ephemeral_used;
1619   fsys_use->ephemeral_iops = ephemeral_iops;
1620
1621   dlist_push_last(&measurement->filesystem_usage, fsys_use);
1622
1623   EVEL_EXIT();
1624 }
1625
1626 /**************************************************************************//**
1627  * Add a Feature usage value name/value pair to the Measurement.
1628  *
1629  * The name is null delimited ASCII string.  The library takes
1630  * a copy so the caller does not have to preserve values after the function
1631  * returns.
1632  *
1633  * @param measurement     Pointer to the measurement.
1634  * @param feature         ASCIIZ string with the feature's name.
1635  * @param utilization     Utilization of the feature.
1636  *****************************************************************************/
1637 void evel_measurement_feature_use_add(EVENT_MEASUREMENT * measurement,
1638                                       char * feature,
1639                                       int utilization)
1640 {
1641   MEASUREMENT_FEATURE_USE * feature_use = NULL;
1642   EVEL_ENTER();
1643
1644   /***************************************************************************/
1645   /* Check assumptions.                                                      */
1646   /***************************************************************************/
1647   assert(measurement != NULL);
1648   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1649   assert(feature != NULL);
1650   assert(utilization >= 0);
1651
1652   /***************************************************************************/
1653   /* Allocate a container for the value and push onto the list.              */
1654   /***************************************************************************/
1655   EVEL_DEBUG("Adding Feature=%s Use=%d", feature, utilization);
1656   feature_use = malloc(sizeof(MEASUREMENT_FEATURE_USE));
1657   assert(feature_use != NULL);
1658   memset(feature_use, 0, sizeof(MEASUREMENT_FEATURE_USE));
1659   feature_use->feature_id = strdup(feature);
1660   assert(feature_use->feature_id != NULL);
1661   feature_use->feature_utilization = utilization;
1662
1663   dlist_push_last(&measurement->feature_usage, feature_use);
1664
1665   EVEL_EXIT();
1666 }
1667
1668 /**************************************************************************//**
1669  * Add a Additional Measurement value name/value pair to the Report.
1670  *
1671  * The name is null delimited ASCII string.  The library takes
1672  * a copy so the caller does not have to preserve values after the function
1673  * returns.
1674  *
1675  * @param measurement   Pointer to the Measaurement.
1676  * @param group    ASCIIZ string with the measurement group's name.
1677  * @param name     ASCIIZ string containing the measurement's name.
1678  * @param value    ASCIIZ string containing the measurement's value.
1679  *****************************************************************************/
1680 void evel_measurement_custom_measurement_add(EVENT_MEASUREMENT * measurement,
1681                                              const char * const group,
1682                                              const char * const name,
1683                                              const char * const value)
1684 {
1685   MEASUREMENT_GROUP * measurement_group = NULL;
1686   CUSTOM_MEASUREMENT * custom_measurement = NULL;
1687   DLIST_ITEM * item = NULL;
1688   EVEL_ENTER();
1689
1690   /***************************************************************************/
1691   /* Check assumptions.                                                      */
1692   /***************************************************************************/
1693   assert(measurement != NULL);
1694   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1695   assert(group != NULL);
1696   assert(name != NULL);
1697   assert(value != NULL);
1698
1699   /***************************************************************************/
1700   /* Allocate a container for the name/value pair.                           */
1701   /***************************************************************************/
1702   EVEL_DEBUG("Adding Measurement Group=%s Name=%s Value=%s",
1703               group, name, value);
1704   custom_measurement = malloc(sizeof(CUSTOM_MEASUREMENT));
1705   assert(custom_measurement != NULL);
1706   memset(custom_measurement, 0, sizeof(CUSTOM_MEASUREMENT));
1707   custom_measurement->name = strdup(name);
1708   assert(custom_measurement->name != NULL);
1709   custom_measurement->value = strdup(value);
1710   assert(custom_measurement->value != NULL);
1711
1712   /***************************************************************************/
1713   /* See if we have that group already.                                      */
1714   /***************************************************************************/
1715   item = dlist_get_first(&measurement->additional_measurements);
1716   while (item != NULL)
1717   {
1718     measurement_group = (MEASUREMENT_GROUP *) item->item;
1719     assert(measurement_group != NULL);
1720
1721     EVEL_DEBUG("Got measurement group %s", measurement_group->name);
1722     if (strcmp(group, measurement_group->name) == 0)
1723     {
1724       EVEL_DEBUG("Found existing Measurement Group");
1725       break;
1726     }
1727     item = dlist_get_next(item);
1728   }
1729
1730   /***************************************************************************/
1731   /* If we didn't have the group already, create it.                         */
1732   /***************************************************************************/
1733   if (item == NULL)
1734   {
1735     EVEL_DEBUG("Creating new Measurement Group");
1736     measurement_group = malloc(sizeof(MEASUREMENT_GROUP));
1737     assert(measurement_group != NULL);
1738     memset(measurement_group, 0, sizeof(MEASUREMENT_GROUP));
1739     measurement_group->name = strdup(group);
1740     assert(measurement_group->name != NULL);
1741     dlist_initialize(&measurement_group->measurements);
1742     dlist_push_last(&measurement->additional_measurements, measurement_group);
1743   }
1744
1745   /***************************************************************************/
1746   /* If we didn't have the group already, create it.                         */
1747   /***************************************************************************/
1748   dlist_push_last(&measurement_group->measurements, custom_measurement);
1749
1750   EVEL_EXIT();
1751 }
1752
1753 /**************************************************************************//**
1754  * Add a Codec usage value name/value pair to the Measurement.
1755  *
1756  * The name is null delimited ASCII string.  The library takes
1757  * a copy so the caller does not have to preserve values after the function
1758  * returns.
1759  *
1760  * @param measurement     Pointer to the measurement.
1761  * @param codec           ASCIIZ string with the codec's name.
1762  * @param utilization     Number of codecs in use.
1763  *****************************************************************************/
1764 void evel_measurement_codec_use_add(EVENT_MEASUREMENT * measurement,
1765                                     char * codec,
1766                                     int utilization)
1767 {
1768   MEASUREMENT_CODEC_USE * codec_use = NULL;
1769   EVEL_ENTER();
1770
1771   /***************************************************************************/
1772   /* Check assumptions.                                                      */
1773   /***************************************************************************/
1774   assert(measurement != NULL);
1775   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1776   assert(codec != NULL);
1777   assert(utilization >= 0.0);
1778
1779   /***************************************************************************/
1780   /* Allocate a container for the value and push onto the list.              */
1781   /***************************************************************************/
1782   EVEL_DEBUG("Adding Codec=%s Use=%d", codec, utilization);
1783   codec_use = malloc(sizeof(MEASUREMENT_CODEC_USE));
1784   assert(codec_use != NULL);
1785   memset(codec_use, 0, sizeof(MEASUREMENT_CODEC_USE));
1786   codec_use->codec_id = strdup(codec);
1787   assert(codec_use->codec_id != NULL);
1788   codec_use->number_in_use = utilization;
1789
1790   dlist_push_last(&measurement->codec_usage, codec_use);
1791
1792   EVEL_EXIT();
1793 }
1794
1795
1796 /**************************************************************************//**
1797  * Set the Media Ports in Use property of the Measurement.
1798  *
1799  * @note  The property is treated as immutable: it is only valid to call
1800  *        the setter once.  However, we don't assert if the caller tries to
1801  *        overwrite, just ignoring the update instead.
1802  *
1803  * @param measurement         Pointer to the measurement.
1804  * @param media_ports_in_use  The media port usage to set.
1805  *****************************************************************************/
1806 void evel_measurement_media_port_use_set(EVENT_MEASUREMENT * measurement,
1807                                          int media_ports_in_use)
1808 {
1809   EVEL_ENTER();
1810
1811   /***************************************************************************/
1812   /* Check preconditions.                                                    */
1813   /***************************************************************************/
1814   assert(measurement != NULL);
1815   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1816   assert(media_ports_in_use >= 0);
1817
1818   evel_set_option_int(&measurement->media_ports_in_use,
1819                       media_ports_in_use,
1820                       "Media Ports In Use");
1821   EVEL_EXIT();
1822 }
1823
1824 /**************************************************************************//**
1825  * Set the VNFC Scaling Metric property of the Measurement.
1826  *
1827  * @note  The property is treated as immutable: it is only valid to call
1828  *        the setter once.  However, we don't assert if the caller tries to
1829  *        overwrite, just ignoring the update instead.
1830  *
1831  * @param measurement     Pointer to the measurement.
1832  * @param scaling_metric  The scaling metric to set.
1833  *****************************************************************************/
1834 void evel_measurement_vnfc_scaling_metric_set(EVENT_MEASUREMENT * measurement,
1835                                               int scaling_metric)
1836 {
1837   EVEL_ENTER();
1838
1839   /***************************************************************************/
1840   /* Check preconditions.                                                    */
1841   /***************************************************************************/
1842   assert(measurement != NULL);
1843   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1844   assert(scaling_metric >= 0.0);
1845
1846   evel_set_option_int(&measurement->vnfc_scaling_metric,
1847                          scaling_metric,
1848                          "VNFC Scaling Metric");
1849   EVEL_EXIT();
1850 }
1851
1852 /**************************************************************************//**
1853  * Create a new Latency Bucket to be added to a Measurement event.
1854  *
1855  * @note    The mandatory fields on the ::MEASUREMENT_LATENCY_BUCKET must be
1856  *          supplied to this factory function and are immutable once set.
1857  *          Optional fields have explicit setter functions, but again values
1858  *          may only be set once so that the ::MEASUREMENT_LATENCY_BUCKET has
1859  *          immutable properties.
1860  *
1861  * @param count         Count of events in this bucket.
1862  *
1863  * @returns pointer to the newly manufactured ::MEASUREMENT_LATENCY_BUCKET.
1864  *          If the structure is not used it must be released using free.
1865  * @retval  NULL  Failed to create the Latency Bucket.
1866  *****************************************************************************/
1867 MEASUREMENT_LATENCY_BUCKET * evel_new_meas_latency_bucket(const int count)
1868 {
1869   MEASUREMENT_LATENCY_BUCKET * bucket;
1870
1871   EVEL_ENTER();
1872
1873   /***************************************************************************/
1874   /* Check preconditions.                                                    */
1875   /***************************************************************************/
1876   assert(count >= 0);
1877
1878   /***************************************************************************/
1879   /* Allocate, then set Mandatory Parameters.                                */
1880   /***************************************************************************/
1881   EVEL_DEBUG("Creating bucket, count = %d", count);
1882   bucket = malloc(sizeof(MEASUREMENT_LATENCY_BUCKET));
1883   assert(bucket != NULL);
1884
1885   /***************************************************************************/
1886   /* Set Mandatory Parameters.                                               */
1887   /***************************************************************************/
1888   bucket->count = count;
1889
1890   /***************************************************************************/
1891   /* Initialize Optional Parameters.                                         */
1892   /***************************************************************************/
1893   evel_init_option_double(&bucket->high_end);
1894   evel_init_option_double(&bucket->low_end);
1895
1896   EVEL_EXIT();
1897
1898   return bucket;
1899 }
1900
1901 /**************************************************************************//**
1902  * Set the High End property of the Measurement Latency Bucket.
1903  *
1904  * @note  The property is treated as immutable: it is only valid to call
1905  *        the setter once.  However, we don't assert if the caller tries to
1906  *        overwrite, just ignoring the update instead.
1907  *
1908  * @param bucket        Pointer to the Measurement Latency Bucket.
1909  * @param high_end      High end of the bucket's range.
1910  *****************************************************************************/
1911 void evel_meas_latency_bucket_high_end_set(
1912                                      MEASUREMENT_LATENCY_BUCKET * const bucket,
1913                                      const double high_end)
1914 {
1915   EVEL_ENTER();
1916
1917   /***************************************************************************/
1918   /* Check preconditions.                                                    */
1919   /***************************************************************************/
1920   assert(high_end >= 0.0);
1921   evel_set_option_double(&bucket->high_end, high_end, "High End");
1922
1923   EVEL_EXIT();
1924 }
1925
1926 /**************************************************************************//**
1927  * Set the Low End property of the Measurement Latency Bucket.
1928  *
1929  * @note  The property is treated as immutable: it is only valid to call
1930  *        the setter once.  However, we don't assert if the caller tries to
1931  *        overwrite, just ignoring the update instead.
1932  *
1933  * @param bucket        Pointer to the Measurement Latency Bucket.
1934  * @param low_end       Low end of the bucket's range.
1935  *****************************************************************************/
1936 void evel_meas_latency_bucket_low_end_set(
1937                                      MEASUREMENT_LATENCY_BUCKET * const bucket,
1938                                      const double low_end)
1939 {
1940   EVEL_ENTER();
1941
1942   /***************************************************************************/
1943   /* Check preconditions.                                                    */
1944   /***************************************************************************/
1945   assert(low_end >= 0.0);
1946   evel_set_option_double(&bucket->low_end, low_end, "Low End");
1947   EVEL_EXIT();
1948 }
1949
1950 /**************************************************************************//**
1951  * Add an additional Measurement Latency Bucket to the specified event.
1952  *
1953  * @param measurement   Pointer to the Measurement event.
1954  * @param bucket        Pointer to the Measurement Latency Bucket to add.
1955  *****************************************************************************/
1956 void evel_meas_latency_bucket_add(EVENT_MEASUREMENT * const measurement,
1957                                   MEASUREMENT_LATENCY_BUCKET * const bucket)
1958 {
1959   EVEL_ENTER();
1960
1961   /***************************************************************************/
1962   /* Check preconditions.                                                    */
1963   /***************************************************************************/
1964   assert(measurement != NULL);
1965   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
1966   assert(bucket != NULL);
1967   dlist_push_last(&measurement->latency_distribution, bucket);
1968
1969   EVEL_EXIT();
1970 }
1971
1972 /**************************************************************************//**
1973  * Add an additional Latency Distribution bucket to the Measurement.
1974  *
1975  * This function implements the previous API, purely for convenience.
1976  *
1977  * @param measurement   Pointer to the measurement.
1978  * @param low_end       Low end of the bucket's range.
1979  * @param high_end      High end of the bucket's range.
1980  * @param count         Count of events in this bucket.
1981  *****************************************************************************/
1982 void evel_measurement_latency_add(EVENT_MEASUREMENT * const measurement,
1983                                   const double low_end,
1984                                   const double high_end,
1985                                   const int count)
1986 {
1987   MEASUREMENT_LATENCY_BUCKET * bucket = NULL;
1988
1989   EVEL_ENTER();
1990
1991   /***************************************************************************/
1992   /* Trust the assertions in the underlying methods.                         */
1993   /***************************************************************************/
1994   bucket = evel_new_meas_latency_bucket(count);
1995   evel_meas_latency_bucket_low_end_set(bucket, low_end);
1996   evel_meas_latency_bucket_high_end_set(bucket, high_end);
1997   evel_meas_latency_bucket_add(measurement, bucket);
1998
1999   EVEL_EXIT();
2000 }
2001
2002 /**************************************************************************//**
2003  * Create a new vNIC Use to be added to a Measurement event.
2004  *
2005  * @note    The mandatory fields on the ::MEASUREMENT_VNIC_PERFORMANCE must be supplied
2006  *          to this factory function and are immutable once set. Optional
2007  *          fields have explicit setter functions, but again values may only be
2008  *          set once so that the ::MEASUREMENT_VNIC_PERFORMANCE has immutable
2009  *          properties.
2010  *
2011  * @param vnic_id               ASCIIZ string with the vNIC's ID.
2012  * @param val_suspect           True or false confidence in data.
2013  *
2014  * @returns pointer to the newly manufactured ::MEASUREMENT_VNIC_PERFORMANCE.
2015  *          If the structure is not used it must be released using
2016  *          ::evel_measurement_free_vnic_performance.
2017  * @retval  NULL  Failed to create the vNIC Use.
2018  *****************************************************************************/
2019 MEASUREMENT_VNIC_PERFORMANCE * evel_measurement_new_vnic_performance(char * const vnic_id,
2020                                                      char * const val_suspect)
2021 {
2022   MEASUREMENT_VNIC_PERFORMANCE * vnic_performance;
2023
2024   EVEL_ENTER();
2025
2026   /***************************************************************************/
2027   /* Check preconditions.                                                    */
2028   /***************************************************************************/
2029   assert(vnic_id != NULL);
2030   assert(!strcmp(val_suspect,"true") || !strcmp(val_suspect,"false"));
2031
2032   /***************************************************************************/
2033   /* Allocate, then set Mandatory Parameters.                                */
2034   /***************************************************************************/
2035   EVEL_DEBUG("Adding VNIC ID=%s", vnic_id);
2036   vnic_performance = malloc(sizeof(MEASUREMENT_VNIC_PERFORMANCE));
2037   assert(vnic_performance != NULL);
2038   vnic_performance->vnic_id = strdup(vnic_id);
2039   vnic_performance->valuesaresuspect = strdup(val_suspect);
2040
2041   /***************************************************************************/
2042   /* Initialize Optional Parameters.                                         */
2043   /***************************************************************************/
2044   evel_init_option_double(&vnic_performance-> recvd_bcast_packets_acc);
2045   evel_init_option_double(&vnic_performance-> recvd_bcast_packets_delta);
2046   evel_init_option_double(&vnic_performance-> recvd_discarded_packets_acc);
2047   evel_init_option_double(&vnic_performance-> recvd_discarded_packets_delta);
2048   evel_init_option_double(&vnic_performance-> recvd_error_packets_acc);
2049   evel_init_option_double(&vnic_performance-> recvd_error_packets_delta);
2050   evel_init_option_double(&vnic_performance-> recvd_mcast_packets_acc);
2051   evel_init_option_double(&vnic_performance-> recvd_mcast_packets_delta);
2052   evel_init_option_double(&vnic_performance-> recvd_octets_acc);
2053   evel_init_option_double(&vnic_performance-> recvd_octets_delta);
2054   evel_init_option_double(&vnic_performance-> recvd_total_packets_acc);
2055   evel_init_option_double(&vnic_performance-> recvd_total_packets_delta);
2056   evel_init_option_double(&vnic_performance-> recvd_ucast_packets_acc);
2057   evel_init_option_double(&vnic_performance-> recvd_ucast_packets_delta);
2058   evel_init_option_double(&vnic_performance-> tx_bcast_packets_acc);
2059   evel_init_option_double(&vnic_performance-> tx_bcast_packets_delta);
2060   evel_init_option_double(&vnic_performance-> tx_discarded_packets_acc);
2061   evel_init_option_double(&vnic_performance-> tx_discarded_packets_delta);
2062   evel_init_option_double(&vnic_performance-> tx_error_packets_acc);
2063   evel_init_option_double(&vnic_performance-> tx_error_packets_delta);
2064   evel_init_option_double(&vnic_performance-> tx_mcast_packets_acc);
2065   evel_init_option_double(&vnic_performance-> tx_mcast_packets_delta);
2066   evel_init_option_double(&vnic_performance-> tx_octets_acc);
2067   evel_init_option_double(&vnic_performance-> tx_octets_delta);
2068   evel_init_option_double(&vnic_performance-> tx_total_packets_acc);
2069   evel_init_option_double(&vnic_performance-> tx_total_packets_delta);
2070   evel_init_option_double(&vnic_performance-> tx_ucast_packets_acc);
2071   evel_init_option_double(&vnic_performance-> tx_ucast_packets_delta);
2072
2073   EVEL_EXIT();
2074
2075   return vnic_performance;
2076 }
2077
2078 /**************************************************************************//**
2079  * Free a vNIC Use.
2080  *
2081  * Free off the ::MEASUREMENT_VNIC_PERFORMANCE supplied.  Will free all the contained
2082  * allocated memory.
2083  *
2084  * @note It does not free the vNIC Use itself, since that may be part of a
2085  * larger structure.
2086  *****************************************************************************/
2087 void evel_measurement_free_vnic_performance(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance)
2088 {
2089   EVEL_ENTER();
2090
2091   /***************************************************************************/
2092   /* Check preconditions.                                                    */
2093   /***************************************************************************/
2094   assert(vnic_performance != NULL);
2095   assert(vnic_performance->vnic_id != NULL);
2096   assert(vnic_performance->valuesaresuspect != NULL);
2097
2098   /***************************************************************************/
2099   /* Free the duplicated string.                                             */
2100   /***************************************************************************/
2101   free(vnic_performance->vnic_id);
2102   free(vnic_performance->valuesaresuspect);
2103   vnic_performance->vnic_id = NULL;
2104
2105   EVEL_EXIT();
2106 }
2107
2108 /**************************************************************************//**
2109  * Set the Accumulated Broadcast Packets Received in measurement interval
2110  * property of the vNIC performance.
2111  *
2112  * @note  The property is treated as immutable: it is only valid to call
2113  *        the setter once.  However, we don't assert if the caller tries to
2114  *        overwrite, just ignoring the update instead.
2115  *
2116  * @param vnic_performance      Pointer to the vNIC Use.
2117  * @param recvd_bcast_packets_acc
2118  *****************************************************************************/
2119 void evel_vnic_performance_rx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2120                                     const double recvd_bcast_packets_acc)
2121 {
2122   EVEL_ENTER();
2123
2124   /***************************************************************************/
2125   /* Check preconditions.                                                    */
2126   /***************************************************************************/
2127   assert(recvd_bcast_packets_acc >= 0.0);
2128
2129   evel_set_option_double(&vnic_performance->recvd_bcast_packets_acc,
2130                       recvd_bcast_packets_acc,
2131                       "Broadcast Packets accumulated");
2132
2133   EVEL_EXIT();
2134 }
2135
2136 /**************************************************************************//**
2137  * Set the Delta Broadcast Packets Received in measurement interval
2138  * property of the vNIC performance.
2139  *
2140  * @note  The property is treated as immutable: it is only valid to call
2141  *        the setter once.  However, we don't assert if the caller tries to
2142  *        overwrite, just ignoring the update instead.
2143  *
2144  * @param vnic_performance      Pointer to the vNIC Use.
2145  * @param recvd_bcast_packets_delta
2146  *****************************************************************************/
2147 void evel_vnic_performance_rx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2148                                     const double recvd_bcast_packets_delta)
2149 {
2150   EVEL_ENTER();
2151
2152   /***************************************************************************/
2153   /* Check preconditions.                                                    */
2154   /***************************************************************************/
2155   assert(recvd_bcast_packets_delta >= 0.0);
2156
2157   evel_set_option_double(&vnic_performance->recvd_bcast_packets_delta,
2158                       recvd_bcast_packets_delta,
2159                       "Delta Broadcast Packets recieved");
2160
2161   EVEL_EXIT();
2162 }
2163
2164
2165 /**************************************************************************//**
2166  * Set the Discarded Packets Received in measurement interval
2167  * property of the vNIC performance.
2168  *
2169  * @note  The property is treated as immutable: it is only valid to call
2170  *        the setter once.  However, we don't assert if the caller tries to
2171  *        overwrite, just ignoring the update instead.
2172  *
2173  * @param vnic_performance      Pointer to the vNIC Use.
2174  * @param recvd_discard_packets_acc
2175  *****************************************************************************/
2176 void evel_vnic_performance_rx_discard_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2177                                     const double recvd_discard_packets_acc)
2178 {
2179   EVEL_ENTER();
2180
2181   /***************************************************************************/
2182   /* Check preconditions.                                                    */
2183   /***************************************************************************/
2184   assert(recvd_discard_packets_acc >= 0.0);
2185
2186   evel_set_option_double(&vnic_performance->recvd_discarded_packets_acc,
2187                       recvd_discard_packets_acc,
2188                       "Discarded Packets accumulated");
2189
2190   EVEL_EXIT();
2191 }
2192
2193 /**************************************************************************//**
2194  * Set the Delta Discarded Packets Received in measurement interval
2195  * property of the vNIC performance.
2196  *
2197  * @note  The property is treated as immutable: it is only valid to call
2198  *        the setter once.  However, we don't assert if the caller tries to
2199  *        overwrite, just ignoring the update instead.
2200  *
2201  * @param vnic_performance      Pointer to the vNIC Use.
2202  * @param recvd_discard_packets_delta
2203  *****************************************************************************/
2204 void evel_vnic_performance_rx_discard_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2205                                     const double recvd_discard_packets_delta)
2206 {
2207   EVEL_ENTER();
2208
2209   /***************************************************************************/
2210   /* Check preconditions.                                                    */
2211   /***************************************************************************/
2212   assert(recvd_discard_packets_delta >= 0.0);
2213
2214   evel_set_option_double(&vnic_performance->recvd_discarded_packets_delta,
2215                       recvd_discard_packets_delta,
2216                       "Delta Discarded Packets recieved");
2217
2218   EVEL_EXIT();
2219 }
2220
2221
2222 /**************************************************************************//**
2223  * Set the Error Packets Received in measurement interval
2224  * property of the vNIC performance.
2225  *
2226  * @note  The property is treated as immutable: it is only valid to call
2227  *        the setter once.  However, we don't assert if the caller tries to
2228  *        overwrite, just ignoring the update instead.
2229  *
2230  * @param vnic_performance      Pointer to the vNIC Use.
2231  * @param recvd_error_packets_acc
2232  *****************************************************************************/
2233 void evel_vnic_performance_rx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2234                                     const double recvd_error_packets_acc)
2235 {
2236   EVEL_ENTER();
2237
2238   /***************************************************************************/
2239   /* Check preconditions.                                                    */
2240   /***************************************************************************/
2241   assert(recvd_error_packets_acc >= 0.0);
2242
2243   evel_set_option_double(&vnic_performance->recvd_error_packets_acc,
2244                       recvd_error_packets_acc,
2245                       "Error Packets received accumulated");
2246
2247   EVEL_EXIT();
2248 }
2249
2250 /**************************************************************************//**
2251  * Set the Delta Error Packets Received in measurement interval
2252  * property of the vNIC performance.
2253  *
2254  * @note  The property is treated as immutable: it is only valid to call
2255  *        the setter once.  However, we don't assert if the caller tries to
2256  *        overwrite, just ignoring the update instead.
2257  *
2258  * @param vnic_performance      Pointer to the vNIC Use.
2259  * @param recvd_error_packets_delta
2260  *****************************************************************************/
2261 void evel_vnic_performance_rx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2262                                     const double recvd_error_packets_delta)
2263 {
2264   EVEL_ENTER();
2265
2266   /***************************************************************************/
2267   /* Check preconditions.                                                    */
2268   /***************************************************************************/
2269   assert(recvd_error_packets_delta >= 0.0);
2270
2271   evel_set_option_double(&vnic_performance->recvd_error_packets_delta,
2272                       recvd_error_packets_delta,
2273                       "Delta Error Packets recieved");
2274
2275   EVEL_EXIT();
2276 }
2277
2278 /**************************************************************************//**
2279  * Set the Accumulated Multicast Packets Received in measurement interval
2280  * property of the vNIC performance.
2281  *
2282  * @note  The property is treated as immutable: it is only valid to call
2283  *        the setter once.  However, we don't assert if the caller tries to
2284  *        overwrite, just ignoring the update instead.
2285  *
2286  * @param vnic_performance      Pointer to the vNIC Use.
2287  * @param recvd_mcast_packets_acc
2288  *****************************************************************************/
2289 void evel_vnic_performance_rx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2290                                     const double recvd_mcast_packets_acc)
2291 {
2292   EVEL_ENTER();
2293
2294   /***************************************************************************/
2295   /* Check preconditions.                                                    */
2296   /***************************************************************************/
2297   assert(recvd_mcast_packets_acc >= 0.0);
2298
2299   evel_set_option_double(&vnic_performance->recvd_mcast_packets_acc,
2300                       recvd_mcast_packets_acc,
2301                       "Multicast Packets accumulated");
2302
2303   EVEL_EXIT();
2304 }
2305
2306 /**************************************************************************//**
2307  * Set the Delta Multicast Packets Received in measurement interval
2308  * property of the vNIC performance.
2309  *
2310  * @note  The property is treated as immutable: it is only valid to call
2311  *        the setter once.  However, we don't assert if the caller tries to
2312  *        overwrite, just ignoring the update instead.
2313  *
2314  * @param vnic_performance      Pointer to the vNIC Use.
2315  * @param recvd_mcast_packets_delta
2316  *****************************************************************************/
2317 void evel_vnic_performance_rx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2318                                     const double recvd_mcast_packets_delta)
2319 {
2320   EVEL_ENTER();
2321
2322   /***************************************************************************/
2323   /* Check preconditions.                                                    */
2324   /***************************************************************************/
2325   assert(recvd_mcast_packets_delta >= 0.0);
2326
2327   evel_set_option_double(&vnic_performance->recvd_mcast_packets_delta,
2328                       recvd_mcast_packets_delta,
2329                       "Delta Multicast Packets recieved");
2330
2331   EVEL_EXIT();
2332 }
2333
2334 /**************************************************************************//**
2335  * Set the Accumulated Octets Received in measurement interval
2336  * property of the vNIC performance.
2337  *
2338  * @note  The property is treated as immutable: it is only valid to call
2339  *        the setter once.  However, we don't assert if the caller tries to
2340  *        overwrite, just ignoring the update instead.
2341  *
2342  * @param vnic_performance      Pointer to the vNIC Use.
2343  * @param recvd_octets_acc
2344  *****************************************************************************/
2345 void evel_vnic_performance_rx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2346                                     const double recvd_octets_acc)
2347 {
2348   EVEL_ENTER();
2349
2350   /***************************************************************************/
2351   /* Check preconditions.                                                    */
2352   /***************************************************************************/
2353   assert(recvd_octets_acc >= 0.0);
2354
2355   evel_set_option_double(&vnic_performance->recvd_octets_acc,
2356                       recvd_octets_acc,
2357                       "Octets received accumulated");
2358
2359   EVEL_EXIT();
2360 }
2361
2362 /**************************************************************************//**
2363  * Set the Delta Octets Received in measurement interval
2364  * property of the vNIC performance.
2365  *
2366  * @note  The property is treated as immutable: it is only valid to call
2367  *        the setter once.  However, we don't assert if the caller tries to
2368  *        overwrite, just ignoring the update instead.
2369  *
2370  * @param vnic_performance      Pointer to the vNIC Use.
2371  * @param recvd_octets_delta
2372  *****************************************************************************/
2373 void evel_vnic_performance_rx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2374                                     const double recvd_octets_delta)
2375 {
2376   EVEL_ENTER();
2377
2378   /***************************************************************************/
2379   /* Check preconditions.                                                    */
2380   /***************************************************************************/
2381   assert(recvd_octets_delta >= 0.0);
2382
2383   evel_set_option_double(&vnic_performance->recvd_octets_delta,
2384                       recvd_octets_delta,
2385                       "Delta Octets recieved");
2386
2387   EVEL_EXIT();
2388 }
2389
2390 /**************************************************************************//**
2391  * Set the Accumulated Total Packets Received in measurement interval
2392  * property of the vNIC performance.
2393  *
2394  * @note  The property is treated as immutable: it is only valid to call
2395  *        the setter once.  However, we don't assert if the caller tries to
2396  *        overwrite, just ignoring the update instead.
2397  *
2398  * @param vnic_performance      Pointer to the vNIC Use.
2399  * @param recvd_total_packets_acc
2400  *****************************************************************************/
2401 void evel_vnic_performance_rx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2402                                     const double recvd_total_packets_acc)
2403 {
2404   EVEL_ENTER();
2405
2406   /***************************************************************************/
2407   /* Check preconditions.                                                    */
2408   /***************************************************************************/
2409   assert(recvd_total_packets_acc >= 0.0);
2410
2411   evel_set_option_double(&vnic_performance->recvd_total_packets_acc,
2412                       recvd_total_packets_acc,
2413                       "Total Packets accumulated");
2414
2415   EVEL_EXIT();
2416 }
2417
2418 /**************************************************************************//**
2419  * Set the Delta Total Packets Received in measurement interval
2420  * property of the vNIC performance.
2421  *
2422  * @note  The property is treated as immutable: it is only valid to call
2423  *        the setter once.  However, we don't assert if the caller tries to
2424  *        overwrite, just ignoring the update instead.
2425  *
2426  * @param vnic_performance      Pointer to the vNIC Use.
2427  * @param recvd_total_packets_delta
2428  *****************************************************************************/
2429 void evel_vnic_performance_rx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2430                                     const double recvd_total_packets_delta)
2431 {
2432   EVEL_ENTER();
2433
2434   /***************************************************************************/
2435   /* Check preconditions.                                                    */
2436   /***************************************************************************/
2437   assert(recvd_total_packets_delta >= 0.0);
2438
2439   evel_set_option_double(&vnic_performance->recvd_total_packets_delta,
2440                       recvd_total_packets_delta,
2441                       "Delta Total Packets recieved");
2442
2443   EVEL_EXIT();
2444 }
2445
2446 /**************************************************************************//**
2447  * Set the Accumulated Unicast Packets Received in measurement interval
2448  * property of the vNIC performance.
2449  *
2450  * @note  The property is treated as immutable: it is only valid to call
2451  *        the setter once.  However, we don't assert if the caller tries to
2452  *        overwrite, just ignoring the update instead.
2453  *
2454  * @param vnic_performance      Pointer to the vNIC Use.
2455  * @param recvd_ucast_packets_acc
2456  *****************************************************************************/
2457 void evel_vnic_performance_rx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2458                                     const double recvd_ucast_packets_acc)
2459 {
2460   EVEL_ENTER();
2461
2462   /***************************************************************************/
2463   /* Check preconditions.                                                    */
2464   /***************************************************************************/
2465   assert(recvd_ucast_packets_acc >= 0.0);
2466
2467   evel_set_option_double(&vnic_performance->recvd_ucast_packets_acc,
2468                       recvd_ucast_packets_acc,
2469                       "Unicast Packets received accumulated");
2470
2471   EVEL_EXIT();
2472 }
2473
2474 /**************************************************************************//**
2475  * Set the Delta Unicast packets Received in measurement interval
2476  * property of the vNIC performance.
2477  *
2478  * @note  The property is treated as immutable: it is only valid to call
2479  *        the setter once.  However, we don't assert if the caller tries to
2480  *        overwrite, just ignoring the update instead.
2481  *
2482  * @param vnic_performance      Pointer to the vNIC Use.
2483  * @param recvd_ucast_packets_delta
2484  *****************************************************************************/
2485 void evel_vnic_performance_rx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2486                                     const double recvd_ucast_packets_delta)
2487 {
2488   EVEL_ENTER();
2489
2490   /***************************************************************************/
2491   /* Check preconditions.                                                    */
2492   /***************************************************************************/
2493   assert(recvd_ucast_packets_delta >= 0.0);
2494
2495   evel_set_option_double(&vnic_performance->recvd_ucast_packets_delta,
2496                       recvd_ucast_packets_delta,
2497                       "Delta Unicast packets recieved");
2498
2499   EVEL_EXIT();
2500 }
2501
2502 /**************************************************************************//**
2503  * Set the Transmitted Broadcast Packets in measurement interval
2504  * property of the vNIC performance.
2505  *
2506  * @note  The property is treated as immutable: it is only valid to call
2507  *        the setter once.  However, we don't assert if the caller tries to
2508  *        overwrite, just ignoring the update instead.
2509  *
2510  * @param vnic_performance      Pointer to the vNIC Use.
2511  * @param tx_bcast_packets_acc
2512  *****************************************************************************/
2513 void evel_vnic_performance_tx_bcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2514                                     const double tx_bcast_packets_acc)
2515 {
2516   EVEL_ENTER();
2517
2518   /***************************************************************************/
2519   /* Check preconditions.                                                    */
2520   /***************************************************************************/
2521   assert(tx_bcast_packets_acc >= 0.0);
2522
2523   evel_set_option_double(&vnic_performance->tx_bcast_packets_acc,
2524                       tx_bcast_packets_acc,
2525                       "Transmitted Broadcast Packets accumulated");
2526
2527   EVEL_EXIT();
2528 }
2529
2530 /**************************************************************************//**
2531  * Set the Delta Broadcast packets Transmitted in measurement interval
2532  * property of the vNIC performance.
2533  *
2534  * @note  The property is treated as immutable: it is only valid to call
2535  *        the setter once.  However, we don't assert if the caller tries to
2536  *        overwrite, just ignoring the update instead.
2537  *
2538  * @param vnic_performance      Pointer to the vNIC Use.
2539  * @param tx_bcast_packets_delta
2540  *****************************************************************************/
2541 void evel_vnic_performance_tx_bcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2542                                     const double tx_bcast_packets_delta)
2543 {
2544   EVEL_ENTER();
2545
2546   /***************************************************************************/
2547   /* Check preconditions.                                                    */
2548   /***************************************************************************/
2549   assert(tx_bcast_packets_delta >= 0.0);
2550
2551   evel_set_option_double(&vnic_performance->tx_bcast_packets_delta,
2552                       tx_bcast_packets_delta,
2553                       "Delta Transmitted Broadcast packets ");
2554
2555   EVEL_EXIT();
2556 }
2557
2558 /**************************************************************************//**
2559  * Set the Transmitted Discarded Packets in measurement interval
2560  * property of the vNIC performance.
2561  *
2562  * @note  The property is treated as immutable: it is only valid to call
2563  *        the setter once.  However, we don't assert if the caller tries to
2564  *        overwrite, just ignoring the update instead.
2565  *
2566  * @param vnic_performance      Pointer to the vNIC Use.
2567  * @param tx_discarded_packets_acc
2568  *****************************************************************************/
2569 void evel_vnic_performance_tx_discarded_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2570                                     const double tx_discarded_packets_acc)
2571 {
2572   EVEL_ENTER();
2573
2574   /***************************************************************************/
2575   /* Check preconditions.                                                    */
2576   /***************************************************************************/
2577   assert(tx_discarded_packets_acc >= 0.0);
2578
2579   evel_set_option_double(&vnic_performance->tx_discarded_packets_acc,
2580                       tx_discarded_packets_acc,
2581                       "Transmitted Discarded Packets accumulated");
2582
2583   EVEL_EXIT();
2584 }
2585
2586 /**************************************************************************//**
2587  * Set the Delta Discarded packets Transmitted in measurement interval
2588  * property of the vNIC performance.
2589  *
2590  * @note  The property is treated as immutable: it is only valid to call
2591  *        the setter once.  However, we don't assert if the caller tries to
2592  *        overwrite, just ignoring the update instead.
2593  *
2594  * @param vnic_performance      Pointer to the vNIC Use.
2595  * @param tx_discarded_packets_delta
2596  *****************************************************************************/
2597 void evel_vnic_performance_tx_discarded_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2598                                     const double tx_discarded_packets_delta)
2599 {
2600   EVEL_ENTER();
2601
2602   /***************************************************************************/
2603   /* Check preconditions.                                                    */
2604   /***************************************************************************/
2605   assert(tx_discarded_packets_delta >= 0.0);
2606
2607   evel_set_option_double(&vnic_performance->tx_discarded_packets_delta,
2608                       tx_discarded_packets_delta,
2609                       "Delta Transmitted Discarded packets ");
2610
2611   EVEL_EXIT();
2612 }
2613
2614 /**************************************************************************//**
2615  * Set the Transmitted Errored Packets in measurement interval
2616  * property of the vNIC performance.
2617  *
2618  * @note  The property is treated as immutable: it is only valid to call
2619  *        the setter once.  However, we don't assert if the caller tries to
2620  *        overwrite, just ignoring the update instead.
2621  *
2622  * @param vnic_performance      Pointer to the vNIC Use.
2623  * @param tx_error_packets_acc
2624  *****************************************************************************/
2625 void evel_vnic_performance_tx_error_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2626                                     const double tx_error_packets_acc)
2627 {
2628   EVEL_ENTER();
2629
2630   /***************************************************************************/
2631   /* Check preconditions.                                                    */
2632   /***************************************************************************/
2633   assert(tx_error_packets_acc >= 0.0);
2634
2635   evel_set_option_double(&vnic_performance->tx_error_packets_acc,
2636                       tx_error_packets_acc,
2637                       "Transmitted Error Packets accumulated");
2638
2639   EVEL_EXIT();
2640 }
2641
2642 /**************************************************************************//**
2643  * Set the Delta Errored packets Transmitted in measurement interval
2644  * property of the vNIC performance.
2645  *
2646  * @note  The property is treated as immutable: it is only valid to call
2647  *        the setter once.  However, we don't assert if the caller tries to
2648  *        overwrite, just ignoring the update instead.
2649  *
2650  * @param vnic_performance      Pointer to the vNIC Use.
2651  * @param tx_error_packets_delta
2652  *****************************************************************************/
2653 void evel_vnic_performance_tx_error_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2654                                     const double tx_error_packets_delta)
2655 {
2656   EVEL_ENTER();
2657
2658   /***************************************************************************/
2659   /* Check preconditions.                                                    */
2660   /***************************************************************************/
2661   assert(tx_error_packets_delta >= 0.0);
2662
2663   evel_set_option_double(&vnic_performance->tx_error_packets_delta,
2664                       tx_error_packets_delta,
2665                       "Delta Transmitted Error packets ");
2666
2667   EVEL_EXIT();
2668 }
2669
2670 /**************************************************************************//**
2671  * Set the Transmitted Multicast Packets in measurement interval
2672  * property of the vNIC performance.
2673  *
2674  * @note  The property is treated as immutable: it is only valid to call
2675  *        the setter once.  However, we don't assert if the caller tries to
2676  *        overwrite, just ignoring the update instead.
2677  *
2678  * @param vnic_performance      Pointer to the vNIC Use.
2679  * @param tx_mcast_packets_acc
2680  *****************************************************************************/
2681 void evel_vnic_performance_tx_mcast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2682                                     const double tx_mcast_packets_acc)
2683 {
2684   EVEL_ENTER();
2685
2686   /***************************************************************************/
2687   /* Check preconditions.                                                    */
2688   /***************************************************************************/
2689   assert(tx_mcast_packets_acc >= 0.0);
2690
2691   evel_set_option_double(&vnic_performance->tx_mcast_packets_acc,
2692                       tx_mcast_packets_acc,
2693                       "Transmitted Multicast Packets accumulated");
2694
2695   EVEL_EXIT();
2696 }
2697
2698 /**************************************************************************//**
2699  * Set the Delta Multicast packets Transmitted in measurement interval
2700  * property of the vNIC performance.
2701  *
2702  * @note  The property is treated as immutable: it is only valid to call
2703  *        the setter once.  However, we don't assert if the caller tries to
2704  *        overwrite, just ignoring the update instead.
2705  *
2706  * @param vnic_performance      Pointer to the vNIC Use.
2707  * @param tx_mcast_packets_delta
2708  *****************************************************************************/
2709 void evel_vnic_performance_tx_mcast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2710                                     const double tx_mcast_packets_delta)
2711 {
2712   EVEL_ENTER();
2713
2714   /***************************************************************************/
2715   /* Check preconditions.                                                    */
2716   /***************************************************************************/
2717   assert(tx_mcast_packets_delta >= 0.0);
2718
2719   evel_set_option_double(&vnic_performance->tx_mcast_packets_delta,
2720                       tx_mcast_packets_delta,
2721                       "Delta Transmitted Multicast packets ");
2722
2723   EVEL_EXIT();
2724 }
2725
2726 /**************************************************************************//**
2727  * Set the Transmitted Octets in measurement interval
2728  * property of the vNIC performance.
2729  *
2730  * @note  The property is treated as immutable: it is only valid to call
2731  *        the setter once.  However, we don't assert if the caller tries to
2732  *        overwrite, just ignoring the update instead.
2733  *
2734  * @param vnic_performance      Pointer to the vNIC Use.
2735  * @param tx_octets_acc
2736  *****************************************************************************/
2737 void evel_vnic_performance_tx_octets_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2738                                     const double tx_octets_acc)
2739 {
2740   EVEL_ENTER();
2741
2742   /***************************************************************************/
2743   /* Check preconditions.                                                    */
2744   /***************************************************************************/
2745   assert(tx_octets_acc >= 0.0);
2746
2747   evel_set_option_double(&vnic_performance->tx_octets_acc,
2748                       tx_octets_acc,
2749                       "Transmitted Octets accumulated");
2750
2751   EVEL_EXIT();
2752 }
2753
2754 /**************************************************************************//**
2755  * Set the Delta Octets Transmitted in measurement interval
2756  * property of the vNIC performance.
2757  *
2758  * @note  The property is treated as immutable: it is only valid to call
2759  *        the setter once.  However, we don't assert if the caller tries to
2760  *        overwrite, just ignoring the update instead.
2761  *
2762  * @param vnic_performance      Pointer to the vNIC Use.
2763  * @param tx_octets_delta
2764  *****************************************************************************/
2765 void evel_vnic_performance_tx_octets_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2766                                     const double tx_octets_delta)
2767 {
2768   EVEL_ENTER();
2769
2770   /***************************************************************************/
2771   /* Check preconditions.                                                    */
2772   /***************************************************************************/
2773   assert(tx_octets_delta >= 0.0);
2774
2775   evel_set_option_double(&vnic_performance->tx_octets_delta,
2776                       tx_octets_delta,
2777                       "Delta Transmitted Octets ");
2778
2779   EVEL_EXIT();
2780 }
2781
2782
2783 /**************************************************************************//**
2784  * Set the Transmitted Total Packets in measurement interval
2785  * property of the vNIC performance.
2786  *
2787  * @note  The property is treated as immutable: it is only valid to call
2788  *        the setter once.  However, we don't assert if the caller tries to
2789  *        overwrite, just ignoring the update instead.
2790  *
2791  * @param vnic_performance      Pointer to the vNIC Use.
2792  * @param tx_total_packets_acc
2793  *****************************************************************************/
2794 void evel_vnic_performance_tx_total_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2795                                     const double tx_total_packets_acc)
2796 {
2797   EVEL_ENTER();
2798
2799   /***************************************************************************/
2800   /* Check preconditions.                                                    */
2801   /***************************************************************************/
2802   assert(tx_total_packets_acc >= 0.0);
2803
2804   evel_set_option_double(&vnic_performance->tx_total_packets_acc,
2805                       tx_total_packets_acc,
2806                       "Transmitted Total Packets accumulated");
2807
2808   EVEL_EXIT();
2809 }
2810
2811 /**************************************************************************//**
2812  * Set the Delta Total Packets Transmitted in measurement interval
2813  * property of the vNIC performance.
2814  *
2815  * @note  The property is treated as immutable: it is only valid to call
2816  *        the setter once.  However, we don't assert if the caller tries to
2817  *        overwrite, just ignoring the update instead.
2818  *
2819  * @param vnic_performance      Pointer to the vNIC Use.
2820  * @param tx_total_packets_delta
2821  *****************************************************************************/
2822 void evel_vnic_performance_tx_total_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2823                                     const double tx_total_packets_delta)
2824 {
2825   EVEL_ENTER();
2826
2827   /***************************************************************************/
2828   /* Check preconditions.                                                    */
2829   /***************************************************************************/
2830   assert(tx_total_packets_delta >= 0.0);
2831
2832   evel_set_option_double(&vnic_performance->tx_total_packets_delta,
2833                       tx_total_packets_delta,
2834                       "Delta Transmitted Total Packets ");
2835
2836   EVEL_EXIT();
2837 }
2838
2839
2840 /**************************************************************************//**
2841  * Set the Transmitted Unicast Packets in measurement interval
2842  * property of the vNIC performance.
2843  *
2844  * @note  The property is treated as immutable: it is only valid to call
2845  *        the setter once.  However, we don't assert if the caller tries to
2846  *        overwrite, just ignoring the update instead.
2847  *
2848  * @param vnic_performance      Pointer to the vNIC Use.
2849  * @param tx_ucast_packets_acc
2850  *****************************************************************************/
2851 void evel_vnic_performance_tx_ucast_pkt_acc_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2852                                     const double mtx_ucast_packets_acc)
2853 {
2854   EVEL_ENTER();
2855
2856   /***************************************************************************/
2857   /* Check preconditions.                                                    */
2858   /***************************************************************************/
2859   assert(mtx_ucast_packets_acc >= 0.0);
2860
2861   evel_set_option_double(&vnic_performance->tx_ucast_packets_acc,
2862                       mtx_ucast_packets_acc,
2863                       "Transmitted Unicast Packets accumulated");
2864
2865   EVEL_EXIT();
2866 }
2867
2868 /**************************************************************************//**
2869  * Set the Delta Octets Transmitted in measurement interval
2870  * property of the vNIC performance.
2871  *
2872  * @note  The property is treated as immutable: it is only valid to call
2873  *        the setter once.  However, we don't assert if the caller tries to
2874  *        overwrite, just ignoring the update instead.
2875  *
2876  * @param vnic_performance      Pointer to the vNIC Use.
2877  * @param tx_ucast_packets_delta
2878  *****************************************************************************/
2879 void evel_vnic_performance_tx_ucast_pkt_delta_set(MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance,
2880                                     const double tx_ucast_packets_delta)
2881 {
2882   EVEL_ENTER();
2883
2884   /***************************************************************************/
2885   /* Check preconditions.                                                    */
2886   /***************************************************************************/
2887   assert(tx_ucast_packets_delta >= 0.0);
2888
2889   evel_set_option_double(&vnic_performance->tx_ucast_packets_delta,
2890                       tx_ucast_packets_delta,
2891                       "Delta Transmitted Unicast Packets ");
2892
2893   EVEL_EXIT();
2894 }
2895
2896
2897 /**************************************************************************//**
2898  * Add an additional vNIC Use to the specified Measurement event.
2899  *
2900  * @param measurement   Pointer to the measurement.
2901  * @param vnic_performance      Pointer to the vNIC Use to add.
2902  *****************************************************************************/
2903 void evel_meas_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
2904                             MEASUREMENT_VNIC_PERFORMANCE * const vnic_performance)
2905 {
2906   EVEL_ENTER();
2907
2908   /***************************************************************************/
2909   /* Check preconditions.                                                    */
2910   /***************************************************************************/
2911   assert(measurement != NULL);
2912   assert(measurement->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
2913   assert(vnic_performance != NULL);
2914
2915   dlist_push_last(&measurement->vnic_usage, vnic_performance);
2916
2917   EVEL_EXIT();
2918 }
2919
2920 /**************************************************************************//**
2921  * Add an additional vNIC usage record Measurement.
2922  *
2923  * This function implements the previous API, purely for convenience.
2924  *
2925  * The ID is null delimited ASCII string.  The library takes a copy so the
2926  * caller does not have to preserve values after the function returns.
2927  *
2928  * @param measurement           Pointer to the measurement.
2929  * @param vnic_id               ASCIIZ string with the vNIC's ID.
2930  * @param valset                true or false confidence level
2931  * @param recvd_bcast_packets_acc         Recieved broadcast packets
2932  * @param recvd_bcast_packets_delta       Received delta broadcast packets
2933  * @param recvd_discarded_packets_acc     Recieved discarded packets
2934  * @param recvd_discarded_packets_delta   Received discarded delta packets
2935  * @param recvd_error_packets_acc         Received error packets
2936  * @param recvd_error_packets_delta,      Received delta error packets
2937  * @param recvd_mcast_packets_acc         Received multicast packets
2938  * @param recvd_mcast_packets_delta       Received delta multicast packets
2939  * @param recvd_octets_acc                Received octets
2940  * @param recvd_octets_delta              Received delta octets
2941  * @param recvd_total_packets_acc         Received total packets
2942  * @param recvd_total_packets_delta       Received delta total packets
2943  * @param recvd_ucast_packets_acc         Received Unicast packets
2944  * @param recvd_ucast_packets_delta       Received delta unicast packets
2945  * @param tx_bcast_packets_acc            Transmitted broadcast packets
2946  * @param tx_bcast_packets_delta          Transmitted delta broadcast packets
2947  * @param tx_discarded_packets_acc        Transmitted packets discarded
2948  * @param tx_discarded_packets_delta      Transmitted delta discarded packets
2949  * @param tx_error_packets_acc            Transmitted error packets
2950  * @param tx_error_packets_delta          Transmitted delta error packets
2951  * @param tx_mcast_packets_acc            Transmitted multicast packets accumulated
2952  * @param tx_mcast_packets_delta          Transmitted delta multicast packets
2953  * @param tx_octets_acc                   Transmitted octets
2954  * @param tx_octets_delta                 Transmitted delta octets
2955  * @param tx_total_packets_acc            Transmitted total packets
2956  * @param tx_total_packets_delta          Transmitted delta total packets
2957  * @param tx_ucast_packets_acc            Transmitted Unicast packets
2958  * @param tx_ucast_packets_delta          Transmitted delta Unicast packets
2959  *****************************************************************************/
2960 void evel_measurement_vnic_performance_add(EVENT_MEASUREMENT * const measurement,
2961                                char * const vnic_id,
2962                                char * valset,
2963                                double recvd_bcast_packets_acc,
2964                                double recvd_bcast_packets_delta,
2965                                double recvd_discarded_packets_acc,
2966                                double recvd_discarded_packets_delta,
2967                                double recvd_error_packets_acc,
2968                                double recvd_error_packets_delta,
2969                                double recvd_mcast_packets_acc,
2970                                double recvd_mcast_packets_delta,
2971                                double recvd_octets_acc,
2972                                double recvd_octets_delta,
2973                                double recvd_total_packets_acc,
2974                                double recvd_total_packets_delta,
2975                                double recvd_ucast_packets_acc,
2976                                double recvd_ucast_packets_delta,
2977                                double tx_bcast_packets_acc,
2978                                double tx_bcast_packets_delta,
2979                                double tx_discarded_packets_acc,
2980                                double tx_discarded_packets_delta,
2981                                double tx_error_packets_acc,
2982                                double tx_error_packets_delta,
2983                                double tx_mcast_packets_acc,
2984                                double tx_mcast_packets_delta,
2985                                double tx_octets_acc,
2986                                double tx_octets_delta,
2987                                double tx_total_packets_acc,
2988                                double tx_total_packets_delta,
2989                                double tx_ucast_packets_acc,
2990                                double tx_ucast_packets_delta)
2991 {
2992   MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
2993   EVEL_ENTER();
2994
2995   /***************************************************************************/
2996   /* Trust the assertions in the underlying methods.                         */
2997   /***************************************************************************/
2998   vnic_performance = evel_measurement_new_vnic_performance(vnic_id, valset);
2999                                            
3000   evel_vnic_performance_rx_bcast_pkt_acc_set(vnic_performance, recvd_bcast_packets_acc);
3001   evel_vnic_performance_rx_bcast_pkt_delta_set(vnic_performance, recvd_bcast_packets_delta);
3002   evel_vnic_performance_rx_discard_pkt_acc_set(vnic_performance, recvd_discarded_packets_acc);
3003   evel_vnic_performance_rx_discard_pkt_delta_set(vnic_performance, recvd_discarded_packets_delta);
3004   evel_vnic_performance_rx_error_pkt_acc_set(vnic_performance, recvd_error_packets_acc);
3005   evel_vnic_performance_rx_error_pkt_delta_set(vnic_performance, recvd_error_packets_delta);
3006   evel_vnic_performance_rx_mcast_pkt_acc_set(vnic_performance, recvd_mcast_packets_acc);
3007   evel_vnic_performance_rx_mcast_pkt_delta_set(vnic_performance, recvd_mcast_packets_delta);
3008   evel_vnic_performance_rx_octets_acc_set(vnic_performance, recvd_octets_acc);
3009   evel_vnic_performance_rx_octets_delta_set(vnic_performance, recvd_octets_delta);
3010   evel_vnic_performance_rx_total_pkt_acc_set(vnic_performance, recvd_total_packets_acc);
3011   evel_vnic_performance_rx_total_pkt_delta_set(vnic_performance, recvd_total_packets_delta);
3012   evel_vnic_performance_rx_ucast_pkt_acc_set(vnic_performance, recvd_ucast_packets_acc);
3013   evel_vnic_performance_rx_ucast_pkt_delta_set(vnic_performance, recvd_ucast_packets_delta);
3014   evel_vnic_performance_tx_bcast_pkt_acc_set(vnic_performance, tx_bcast_packets_acc);
3015   evel_vnic_performance_tx_bcast_pkt_delta_set(vnic_performance, tx_bcast_packets_delta);
3016   evel_vnic_performance_tx_discarded_pkt_acc_set(vnic_performance, tx_discarded_packets_acc);
3017   evel_vnic_performance_tx_discarded_pkt_delta_set(vnic_performance, tx_discarded_packets_delta);
3018   evel_vnic_performance_tx_error_pkt_acc_set(vnic_performance, tx_error_packets_acc);
3019   evel_vnic_performance_tx_error_pkt_delta_set(vnic_performance, tx_error_packets_delta);
3020   evel_vnic_performance_tx_mcast_pkt_acc_set(vnic_performance, tx_mcast_packets_acc);
3021   evel_vnic_performance_tx_mcast_pkt_delta_set(vnic_performance, tx_mcast_packets_delta);
3022   evel_vnic_performance_tx_octets_acc_set(vnic_performance, tx_octets_acc);
3023   evel_vnic_performance_tx_octets_delta_set(vnic_performance, tx_octets_delta);
3024   evel_vnic_performance_tx_total_pkt_acc_set(vnic_performance, tx_total_packets_acc);
3025   evel_vnic_performance_tx_total_pkt_delta_set(vnic_performance, tx_total_packets_delta);
3026   evel_vnic_performance_tx_ucast_pkt_acc_set(vnic_performance, tx_ucast_packets_acc);
3027   evel_vnic_performance_tx_ucast_pkt_delta_set(vnic_performance, tx_ucast_packets_delta);
3028   evel_meas_vnic_performance_add(measurement, vnic_performance);
3029 }
3030
3031 /**************************************************************************//**
3032  * Encode the measurement as a JSON measurement.
3033  *
3034  * @param jbuf          Pointer to the ::EVEL_JSON_BUFFER to encode into.
3035  * @param event         Pointer to the ::EVENT_HEADER to encode.
3036  *****************************************************************************/
3037 void evel_json_encode_measurement(EVEL_JSON_BUFFER * jbuf,
3038                                   EVENT_MEASUREMENT * event)
3039 {
3040   MEASUREMENT_CPU_USE * cpu_use = NULL;
3041   MEASUREMENT_MEM_USE * mem_use = NULL;
3042   MEASUREMENT_DISK_USE * disk_use = NULL;
3043   MEASUREMENT_FSYS_USE * fsys_use = NULL;
3044   MEASUREMENT_LATENCY_BUCKET * bucket = NULL;
3045   MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
3046   MEASUREMENT_ERRORS * errors = NULL;
3047   MEASUREMENT_FEATURE_USE * feature_use = NULL;
3048   MEASUREMENT_CODEC_USE * codec_use = NULL;
3049   MEASUREMENT_GROUP * measurement_group = NULL;
3050   CUSTOM_MEASUREMENT * custom_measurement = NULL;
3051   DLIST_ITEM * item = NULL;
3052   DLIST_ITEM * nested_item = NULL;
3053   DLIST_ITEM * addl_info_item = NULL;
3054   OTHER_FIELD *addl_info = NULL;
3055   DLIST_ITEM * other_field_item = NULL;
3056   EVEL_JSON_OBJECT_INSTANCE * jsonobjinst = NULL;
3057   EVEL_JSON_OBJECT * jsonobjp = NULL;
3058   DLIST_ITEM * jsobj_field_item = NULL;
3059   EVEL_INTERNAL_KEY * keyinst = NULL;
3060   DLIST_ITEM * keyinst_field_item = NULL;
3061
3062
3063   EVEL_ENTER();
3064
3065   /***************************************************************************/
3066   /* Check preconditions.                                                    */
3067   /***************************************************************************/
3068   assert(event != NULL);
3069   assert(event->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
3070
3071   evel_json_encode_header(jbuf, &event->header);
3072   evel_json_open_named_object(jbuf, "measurementsForVfScalingFields");
3073
3074   /***************************************************************************/
3075   /* Mandatory fields.                                                       */
3076   /***************************************************************************/
3077   evel_enc_kv_int(jbuf, "measurementInterval", event->measurement_interval);
3078
3079   /***************************************************************************/
3080   /* Optional fields.                                                        */
3081   /***************************************************************************/
3082   // additional fields
3083   evel_json_checkpoint(jbuf);
3084   if (evel_json_open_opt_named_list(jbuf, "additionalFields"))
3085   {
3086     bool item_added = false;
3087
3088     addl_info_item = dlist_get_first(&event->additional_info);
3089     while (addl_info_item != NULL)
3090     {
3091       addl_info = (OTHER_FIELD*) addl_info_item->item;
3092       assert(addl_info != NULL);
3093
3094       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3095                                           "additionalFields",
3096                                           addl_info->name))
3097       {
3098         evel_json_open_object(jbuf);
3099         evel_enc_kv_string(jbuf, "name", addl_info->name);
3100         evel_enc_kv_string(jbuf, "value", addl_info->value);
3101         evel_json_close_object(jbuf);
3102         item_added = true;
3103       }
3104       addl_info_item = dlist_get_next(addl_info_item);
3105     }
3106     evel_json_close_list(jbuf);
3107
3108     /*************************************************************************/
3109     /* If we've not written anything, rewind to before we opened the list.   */
3110     /*************************************************************************/
3111     if (!item_added)
3112     {
3113       evel_json_rewind(jbuf);
3114     }
3115   }
3116
3117
3118   evel_json_checkpoint(jbuf);
3119   if(evel_json_open_opt_named_list(jbuf, "additionalObjects"))
3120   {
3121   bool item_added = false;
3122   other_field_item = dlist_get_first(&event->additional_objects);
3123   while (other_field_item != NULL)
3124   {
3125     jsonobjp = (EVEL_JSON_OBJECT *) other_field_item->item;
3126     if(jsonobjp != NULL)
3127     {
3128      evel_json_open_object(jbuf);
3129
3130        if( evel_json_open_opt_named_list(jbuf, "objectInstances"))
3131        {
3132         bool item_added2 = false;
3133         jsobj_field_item = dlist_get_first(&jsonobjp->jsonobjectinstances);
3134         while (jsobj_field_item != NULL)
3135         {
3136            jsonobjinst = (EVEL_JSON_OBJECT_INSTANCE *) jsobj_field_item->item;
3137            if( jsonobjinst != NULL )
3138            {
3139               evel_json_open_object(jbuf);
3140               evel_enc_kv_object(jbuf, "objectInstance", jsonobjinst->jsonstring);
3141               evel_enc_kv_opt_ull(jbuf, "objectInstanceEpochMicrosec", &jsonobjinst->objinst_epoch_microsec);
3142   //evel_json_checkpoint(jbuf);
3143   if (evel_json_open_opt_named_list(jbuf, "objectKeys"))
3144   {
3145     bool item_added3 = false;
3146
3147     keyinst_field_item = dlist_get_first(&jsonobjinst->object_keys);
3148     while (keyinst_field_item != NULL)
3149     {
3150       keyinst = (EVEL_INTERNAL_KEY *)keyinst_field_item->item;
3151       if(keyinst != NULL)
3152       {
3153         evel_json_open_object(jbuf);
3154         evel_enc_kv_string(jbuf, "keyName", keyinst->keyname);
3155         evel_enc_kv_opt_int(jbuf, "keyOrder", &keyinst->keyorder);
3156         evel_enc_kv_opt_string(jbuf, "keyValue", &keyinst->keyvalue);
3157         evel_json_close_object(jbuf);
3158         item_added3 = true;
3159       }
3160       keyinst_field_item = dlist_get_next(keyinst_field_item);
3161     }
3162     evel_json_close_list(jbuf);
3163
3164     /*************************************************************************/
3165     /* If we've not written anything, rewind to before we opened the list.   */
3166     /*************************************************************************/
3167     //if (!item_added3)
3168     //{
3169     //  evel_json_rewind(jbuf);
3170     //}
3171   }
3172                evel_json_close_object(jbuf);
3173             }
3174             item_added2 = true;
3175             jsobj_field_item = dlist_get_next(jsobj_field_item);
3176         }
3177         evel_json_close_list(jbuf);
3178         if( !item_added2 )
3179         {
3180           evel_json_rewind(jbuf);
3181         }
3182        }
3183
3184     evel_enc_kv_string(jbuf, "objectName", jsonobjp->object_name);
3185     evel_enc_kv_opt_string(jbuf, "objectSchema", &jsonobjp->objectschema);
3186     evel_enc_kv_opt_string(jbuf, "objectSchemaUrl", &jsonobjp->objectschemaurl);
3187     evel_enc_kv_opt_string(jbuf, "nfSubscribedObjectName", &jsonobjp->nfsubscribedobjname);
3188     evel_enc_kv_opt_string(jbuf, "nfSubscriptionId", &jsonobjp->nfsubscriptionid);
3189     evel_json_close_object(jbuf);
3190     item_added = true;
3191   }
3192   other_field_item = dlist_get_next(other_field_item);
3193   }
3194   evel_json_close_list(jbuf);
3195
3196   if (!item_added)
3197   {
3198      evel_json_rewind(jbuf);
3199   }
3200   }
3201
3202
3203   // TBD additional json objects
3204   evel_enc_kv_opt_int(jbuf, "concurrentSessions", &event->concurrent_sessions);
3205   evel_enc_kv_opt_int(jbuf, "configuredEntities", &event->configured_entities);
3206
3207   /***************************************************************************/
3208   /* CPU Use list.                                                           */
3209   /***************************************************************************/
3210   evel_json_checkpoint(jbuf);
3211   if (evel_json_open_opt_named_list(jbuf, "cpuUsageArray"))
3212   {
3213     bool item_added = false;
3214
3215     item = dlist_get_first(&event->cpu_usage);
3216     while (item != NULL)
3217     {
3218       cpu_use = (MEASUREMENT_CPU_USE*) item->item;
3219       assert(cpu_use != NULL);
3220
3221       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3222                                           "cpuUsageArray",
3223                                           cpu_use->id))
3224       {
3225         evel_json_open_object(jbuf);
3226         evel_enc_kv_string(jbuf, "cpuIdentifier", cpu_use->id);
3227         evel_enc_kv_opt_double(jbuf, "cpuIdle", &cpu_use->idle);
3228         evel_enc_kv_opt_double(jbuf, "cpuUsageInterrupt", &cpu_use->intrpt);
3229         evel_enc_kv_opt_double(jbuf, "cpuUsageNice", &cpu_use->nice);
3230         evel_enc_kv_opt_double(jbuf, "cpuUsageSoftIrq", &cpu_use->softirq);
3231         evel_enc_kv_opt_double(jbuf, "cpuUsageSteal", &cpu_use->steal);
3232         evel_enc_kv_opt_double(jbuf, "cpuUsageSystem", &cpu_use->sys);
3233         evel_enc_kv_opt_double(jbuf, "cpuUsageUser", &cpu_use->user);
3234         evel_enc_kv_opt_double(jbuf, "cpuWait", &cpu_use->wait);
3235         evel_enc_kv_double(jbuf, "percentUsage",cpu_use->usage);
3236         evel_json_close_object(jbuf);
3237         item_added = true;
3238       }
3239       item = dlist_get_next(item);
3240     }
3241     evel_json_close_list(jbuf);
3242
3243     /*************************************************************************/
3244     /* If we've not written anything, rewind to before we opened the list.   */
3245     /*************************************************************************/
3246     if (!item_added)
3247     {
3248       evel_json_rewind(jbuf);
3249     }
3250   }
3251
3252
3253   /***************************************************************************/
3254   /* Disk Use list.                                                           */
3255   /***************************************************************************/
3256   evel_json_checkpoint(jbuf);
3257   if (evel_json_open_opt_named_list(jbuf, "diskUsageArray"))
3258   {
3259     bool item_added = false;
3260
3261     item = dlist_get_first(&event->disk_usage);
3262     while (item != NULL)
3263     {
3264       disk_use = (MEASUREMENT_DISK_USE*) item->item;
3265       assert(disk_use != NULL);
3266
3267       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3268                                           "diskUsageArray",
3269                                           disk_use->id))
3270       {
3271         evel_json_open_object(jbuf);
3272         evel_enc_kv_string(jbuf, "diskIdentifier", disk_use->id);
3273         evel_enc_kv_opt_double(jbuf, "diskIoTimeAvg", &disk_use->iotimeavg);
3274         evel_enc_kv_opt_double(jbuf, "diskIoTimeLast", &disk_use->iotimelast);
3275         evel_enc_kv_opt_double(jbuf, "diskIoTimeMax", &disk_use->iotimemax);
3276         evel_enc_kv_opt_double(jbuf, "diskIoTimeMin", &disk_use->iotimemin);
3277         evel_enc_kv_opt_double(jbuf, "diskMergedReadAvg", &disk_use->mergereadavg);
3278         evel_enc_kv_opt_double(jbuf, "diskMergedReadLast", &disk_use->mergereadlast);
3279         evel_enc_kv_opt_double(jbuf, "diskMergedReadMax", &disk_use->mergereadmax);
3280         evel_enc_kv_opt_double(jbuf, "diskMergedReadMin", &disk_use->mergereadmin);
3281         evel_enc_kv_opt_double(jbuf, "diskMergedWriteAvg", &disk_use->mergewriteavg);
3282         evel_enc_kv_opt_double(jbuf, "diskMergedWriteLast", &disk_use->mergewritelast);
3283         evel_enc_kv_opt_double(jbuf, "diskMergedWriteMax", &disk_use->mergewritemax);
3284         evel_enc_kv_opt_double(jbuf, "diskMergedWriteMin", &disk_use->mergewritemin);
3285         evel_enc_kv_opt_double(jbuf, "diskOctetsReadAvg", &disk_use->octetsreadavg);
3286         evel_enc_kv_opt_double(jbuf, "diskOctetsReadLast", &disk_use->octetsreadlast);
3287         evel_enc_kv_opt_double(jbuf, "diskOctetsReadMax", &disk_use->octetsreadmax);
3288         evel_enc_kv_opt_double(jbuf, "diskOctetsReadMin", &disk_use->octetsreadmin);
3289         evel_enc_kv_opt_double(jbuf, "diskOctetsWriteAvg", &disk_use->octetswriteavg);
3290         evel_enc_kv_opt_double(jbuf, "diskOctetsWriteLast", &disk_use->octetswritelast);
3291         evel_enc_kv_opt_double(jbuf, "diskOctetsWriteMax", &disk_use->octetswritemax);
3292         evel_enc_kv_opt_double(jbuf, "diskOctetsWriteMin", &disk_use->octetswritemin);
3293         evel_enc_kv_opt_double(jbuf, "diskOpsReadAvg", &disk_use->opsreadavg);
3294         evel_enc_kv_opt_double(jbuf, "diskOpsReadLast", &disk_use->opsreadlast);
3295         evel_enc_kv_opt_double(jbuf, "diskOpsReadMax", &disk_use->opsreadmax);
3296         evel_enc_kv_opt_double(jbuf, "diskOpsReadMin", &disk_use->opsreadmin);
3297         evel_enc_kv_opt_double(jbuf, "diskOpsWriteAvg", &disk_use->opswriteavg);
3298         evel_enc_kv_opt_double(jbuf, "diskOpsWriteLast", &disk_use->opswritelast);
3299         evel_enc_kv_opt_double(jbuf, "diskOpsWriteMax", &disk_use->opswritemax);
3300         evel_enc_kv_opt_double(jbuf, "diskOpsWriteMin", &disk_use->opswritemin);
3301         evel_enc_kv_opt_double(jbuf, "diskPendingOperationsAvg", &disk_use->pendingopsavg);
3302         evel_enc_kv_opt_double(jbuf, "diskPendingOperationsLast", &disk_use->pendingopslast);
3303         evel_enc_kv_opt_double(jbuf, "diskPendingOperationsMax", &disk_use->pendingopsmax);
3304         evel_enc_kv_opt_double(jbuf, "diskPendingOperationsMin", &disk_use->pendingopsmin);
3305         evel_enc_kv_opt_double(jbuf, "diskTimeReadAvg", &disk_use->timereadavg);
3306         evel_enc_kv_opt_double(jbuf, "diskTimeReadLast", &disk_use->timereadlast);
3307         evel_enc_kv_opt_double(jbuf, "diskTimeReadMax", &disk_use->timereadmax);
3308         evel_enc_kv_opt_double(jbuf, "diskTimeReadMin", &disk_use->timereadmin);
3309         evel_enc_kv_opt_double(jbuf, "diskTimeWriteAvg", &disk_use->timewriteavg);
3310         evel_enc_kv_opt_double(jbuf, "diskTimeWriteLast", &disk_use->timewritelast);
3311         evel_enc_kv_opt_double(jbuf, "diskTimeWriteMax", &disk_use->timewritemax);
3312         evel_enc_kv_opt_double(jbuf, "diskTimeWriteMin", &disk_use->timewritemin);
3313         evel_json_close_object(jbuf);
3314         item_added = true;
3315       }
3316       item = dlist_get_next(item);
3317     }
3318     evel_json_close_list(jbuf);
3319
3320     /*************************************************************************/
3321     /* If we've not written anything, rewind to before we opened the list.   */
3322     /*************************************************************************/
3323     if (!item_added)
3324     {
3325       evel_json_rewind(jbuf);
3326     }
3327   }
3328
3329   /***************************************************************************/
3330   /* Filesystem Usage list.                                                  */
3331   /***************************************************************************/
3332   evel_json_checkpoint(jbuf);
3333   if (evel_json_open_opt_named_list(jbuf, "filesystemUsageArray"))
3334   {
3335     bool item_added = false;
3336
3337     item = dlist_get_first(&event->filesystem_usage);
3338     while (item != NULL)
3339     {
3340       fsys_use = (MEASUREMENT_FSYS_USE *) item->item;
3341       assert(fsys_use != NULL);
3342
3343       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3344                                           "filesystemUsageArray",
3345                                           fsys_use->filesystem_name))
3346       {
3347         evel_json_open_object(jbuf);
3348         evel_enc_kv_string(jbuf, "filesystemName", fsys_use->filesystem_name);
3349         evel_enc_kv_double(
3350           jbuf, "blockConfigured", fsys_use->block_configured);
3351         evel_enc_kv_double(jbuf, "blockIops", fsys_use->block_iops);
3352         evel_enc_kv_double(jbuf, "blockUsed", fsys_use->block_used);
3353         evel_enc_kv_double(
3354           jbuf, "ephemeralConfigured", fsys_use->ephemeral_configured);
3355         evel_enc_kv_double(jbuf, "ephemeralIops", fsys_use->ephemeral_iops);
3356         evel_enc_kv_double(jbuf, "ephemeralUsed", fsys_use->ephemeral_used);
3357         evel_json_close_object(jbuf);
3358         item_added = true;
3359       }
3360       item = dlist_get_next(item);
3361     }
3362     evel_json_close_list(jbuf);
3363
3364     /*************************************************************************/
3365     /* If we've not written anything, rewind to before we opened the list.   */
3366     /*************************************************************************/
3367     if (!item_added)
3368     {
3369       evel_json_rewind(jbuf);
3370     }
3371   }
3372
3373   /***************************************************************************/
3374   /* Latency distribution.                                                   */
3375   /***************************************************************************/
3376   item = dlist_get_first(&event->latency_distribution);
3377   if ((item != NULL) &&
3378       evel_json_open_opt_named_list(jbuf, "latencyDistribution"))
3379   {
3380     while (item != NULL)
3381     {
3382       bucket = (MEASUREMENT_LATENCY_BUCKET*) item->item;
3383       assert(bucket != NULL);
3384
3385       evel_json_open_object(jbuf);
3386       evel_enc_kv_opt_double(
3387         jbuf, "lowEndOfLatencyBucket", &bucket->low_end);
3388       evel_enc_kv_opt_double(
3389         jbuf, "highEndOfLatencyBucket", &bucket->high_end);
3390       evel_enc_kv_int(jbuf, "countsInTheBucket", bucket->count);
3391       evel_json_close_object(jbuf);
3392       item = dlist_get_next(item);
3393     }
3394     evel_json_close_list(jbuf);
3395   }
3396
3397   evel_enc_kv_opt_double(
3398     jbuf, "meanRequestLatency", &event->mean_request_latency);
3399   evel_enc_kv_opt_int(jbuf, "requestRate", &event->request_rate);
3400
3401   /***************************************************************************/
3402   /* vNIC Usage TBD Performance array                          */
3403   /***************************************************************************/
3404   evel_json_checkpoint(jbuf);
3405   if (evel_json_open_opt_named_list(jbuf, "vNicPerformanceArray"))
3406   {
3407     bool item_added = false;
3408
3409     item = dlist_get_first(&event->vnic_usage);
3410     while (item != NULL)
3411     {
3412       vnic_performance = (MEASUREMENT_VNIC_PERFORMANCE *) item->item;
3413       assert(vnic_performance != NULL);
3414
3415       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3416                                           "vNicPerformanceArray",
3417                                           vnic_performance->vnic_id))
3418       {
3419         evel_json_open_object(jbuf);
3420
3421         /*********************************************************************/
3422         /* Optional fields.                                                  */
3423         /*********************************************************************/
3424         evel_enc_kv_opt_double( jbuf,
3425                  "receivedBroadcastPacketsAccumulated", &vnic_performance->recvd_bcast_packets_acc);
3426         evel_enc_kv_opt_double( jbuf,
3427                  "receivedBroadcastPacketsDelta", &vnic_performance->recvd_bcast_packets_delta);
3428         evel_enc_kv_opt_double( jbuf,
3429                  "receivedDiscardedPacketsAccumulated", &vnic_performance->recvd_discarded_packets_acc);
3430         evel_enc_kv_opt_double( jbuf,
3431                  "receivedDiscardedPacketsDelta", &vnic_performance->recvd_discarded_packets_delta);
3432         evel_enc_kv_opt_double( jbuf,
3433                  "receivedErrorPacketsAccumulated", &vnic_performance->recvd_error_packets_acc);
3434         evel_enc_kv_opt_double( jbuf,
3435                  "receivedErrorPacketsDelta", &vnic_performance->recvd_error_packets_delta);
3436         evel_enc_kv_opt_double( jbuf,
3437                  "receivedMulticastPacketsAccumulated", &vnic_performance->recvd_mcast_packets_acc);
3438         evel_enc_kv_opt_double( jbuf,
3439                  "receivedMulticastPacketsDelta", &vnic_performance->recvd_mcast_packets_delta);
3440         evel_enc_kv_opt_double( jbuf,
3441                  "receivedOctetsAccumulated", &vnic_performance->recvd_octets_acc);
3442         evel_enc_kv_opt_double( jbuf,
3443                  "receivedOctetsDelta", &vnic_performance->recvd_octets_delta);
3444         evel_enc_kv_opt_double( jbuf,
3445                  "receivedTotalPacketsAccumulated", &vnic_performance->recvd_total_packets_acc);
3446         evel_enc_kv_opt_double( jbuf,
3447                  "receivedTotalPacketsDelta", &vnic_performance->recvd_total_packets_delta);
3448         evel_enc_kv_opt_double( jbuf,
3449                  "receivedUnicastPacketsAccumulated", &vnic_performance->recvd_ucast_packets_acc);
3450         evel_enc_kv_opt_double( jbuf,
3451                  "receivedUnicastPacketsDelta", &vnic_performance->recvd_ucast_packets_delta);
3452         evel_enc_kv_opt_double( jbuf,
3453                  "transmittedBroadcastPacketsAccumulated", &vnic_performance->tx_bcast_packets_acc);
3454         evel_enc_kv_opt_double( jbuf,
3455                  "transmittedBroadcastPacketsDelta", &vnic_performance->tx_bcast_packets_delta);
3456         evel_enc_kv_opt_double( jbuf,
3457                  "transmittedDiscardedPacketsAccumulated", &vnic_performance->tx_discarded_packets_acc);
3458         evel_enc_kv_opt_double( jbuf,
3459                  "transmittedDiscardedPacketsDelta", &vnic_performance->tx_discarded_packets_delta);
3460         evel_enc_kv_opt_double( jbuf,
3461                  "transmittedErrorPacketsAccumulated", &vnic_performance->tx_error_packets_acc);
3462         evel_enc_kv_opt_double( jbuf,
3463                  "transmittedErrorPacketsDelta", &vnic_performance->tx_error_packets_delta);
3464         evel_enc_kv_opt_double( jbuf,
3465                  "transmittedMulticastPacketsAccumulated", &vnic_performance->tx_mcast_packets_acc);
3466         evel_enc_kv_opt_double( jbuf,
3467                  "transmittedMulticastPacketsDelta", &vnic_performance->tx_mcast_packets_delta);
3468         evel_enc_kv_opt_double( jbuf,
3469                  "transmittedOctetsAccumulated", &vnic_performance->tx_octets_acc);
3470         evel_enc_kv_opt_double( jbuf,
3471                  "transmittedOctetsDelta", &vnic_performance->tx_octets_delta);
3472         evel_enc_kv_opt_double( jbuf,
3473                  "transmittedTotalPacketsAccumulated", &vnic_performance->tx_total_packets_acc);
3474         evel_enc_kv_opt_double( jbuf,
3475                  "transmittedTotalPacketsDelta", &vnic_performance->tx_total_packets_delta);
3476         evel_enc_kv_opt_double( jbuf,
3477                  "transmittedUnicastPacketsAccumulated", &vnic_performance->tx_ucast_packets_acc);
3478         evel_enc_kv_opt_double( jbuf,
3479                  "transmittedUnicastPacketsDelta", &vnic_performance->tx_ucast_packets_delta);
3480
3481         /*********************************************************************/
3482         /* Mandatory fields.                                                 */
3483         /*********************************************************************/
3484         evel_enc_kv_string(jbuf, "valuesAreSuspect", vnic_performance->valuesaresuspect);
3485         evel_enc_kv_string(jbuf, "vNicIdentifier", vnic_performance->vnic_id);
3486
3487         evel_json_close_object(jbuf);
3488         item_added = true;
3489       }
3490       item = dlist_get_next(item);
3491     }
3492
3493     evel_json_close_list(jbuf);
3494
3495     /*************************************************************************/
3496     /* If we've not written anything, rewind to before we opened the list.   */
3497     /*************************************************************************/
3498     if (!item_added)
3499     {
3500       evel_json_rewind(jbuf);
3501     }
3502   }
3503
3504
3505   /***************************************************************************/
3506   /* Memory Use list.                                                           */
3507   /***************************************************************************/
3508   evel_json_checkpoint(jbuf);
3509   if (evel_json_open_opt_named_list(jbuf, "memoryUsageArray"))
3510   {
3511     bool item_added = false;
3512
3513     item = dlist_get_first(&event->mem_usage);
3514     while (item != NULL)
3515     {
3516       mem_use = (MEASUREMENT_MEM_USE*) item->item;
3517       assert(mem_use != NULL);
3518
3519       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3520                                           "memoryUsageArray",
3521                                           mem_use->id))
3522       {
3523         evel_json_open_object(jbuf);
3524         evel_enc_kv_double(jbuf, "memoryBuffered", mem_use->membuffsz);
3525         evel_enc_kv_opt_double(jbuf, "memoryCached", &mem_use->memcache);
3526         evel_enc_kv_opt_double(jbuf, "memoryConfigured", &mem_use->memconfig);
3527         evel_enc_kv_opt_double(jbuf, "memoryFree", &mem_use->memfree);
3528         evel_enc_kv_opt_double(jbuf, "memorySlabRecl", &mem_use->slabrecl);
3529         evel_enc_kv_opt_double(jbuf, "memorySlabUnrecl", &mem_use->slabunrecl);
3530         evel_enc_kv_opt_double(jbuf, "memoryUsed", &mem_use->memused);
3531         evel_enc_kv_string(jbuf, "vmIdentifier", mem_use->id);
3532         evel_json_close_object(jbuf);
3533         item_added = true;
3534       }
3535       item = dlist_get_next(item);
3536     }
3537     evel_json_close_list(jbuf);
3538
3539     /*************************************************************************/
3540     /* If we've not written anything, rewind to before we opened the list.   */
3541     /*************************************************************************/
3542     if (!item_added)
3543     {
3544       evel_json_rewind(jbuf);
3545     }
3546   }
3547
3548
3549   evel_enc_kv_opt_int(
3550     jbuf, "numberOfMediaPortsInUse", &event->media_ports_in_use);
3551   evel_enc_kv_opt_int(
3552     jbuf, "vnfcScalingMetric", &event->vnfc_scaling_metric);
3553
3554   /***************************************************************************/
3555   /* Errors list.                                                            */
3556   /***************************************************************************/
3557   if ((event->errors != NULL) &&
3558       evel_json_open_opt_named_object(jbuf, "errors"))
3559   {
3560     errors = event->errors;
3561     evel_enc_kv_int(jbuf, "receiveDiscards", errors->receive_discards);
3562     evel_enc_kv_int(jbuf, "receiveErrors", errors->receive_errors);
3563     evel_enc_kv_int(jbuf, "transmitDiscards", errors->transmit_discards);
3564     evel_enc_kv_int(jbuf, "transmitErrors", errors->transmit_errors);
3565     evel_json_close_object(jbuf);
3566   }
3567
3568   /***************************************************************************/
3569   /* Feature Utilization list.                                               */
3570   /***************************************************************************/
3571   evel_json_checkpoint(jbuf);
3572   if (evel_json_open_opt_named_list(jbuf, "featureUsageArray"))
3573   {
3574     bool item_added = false;
3575
3576     item = dlist_get_first(&event->feature_usage);
3577     while (item != NULL)
3578     {
3579       feature_use = (MEASUREMENT_FEATURE_USE*) item->item;
3580       assert(feature_use != NULL);
3581
3582       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3583                                           "featureUsageArray",
3584                                           feature_use->feature_id))
3585       {
3586         evel_json_open_object(jbuf);
3587         evel_enc_kv_string(jbuf, "featureIdentifier", feature_use->feature_id);
3588         evel_enc_kv_int(
3589           jbuf, "featureUtilization", feature_use->feature_utilization);
3590         evel_json_close_object(jbuf);
3591         item_added = true;
3592       }
3593       item = dlist_get_next(item);
3594     }
3595     evel_json_close_list(jbuf);
3596
3597     /*************************************************************************/
3598     /* If we've not written anything, rewind to before we opened the list.   */
3599     /*************************************************************************/
3600     if (!item_added)
3601     {
3602       evel_json_rewind(jbuf);
3603     }
3604   }
3605
3606   /***************************************************************************/
3607   /* Codec Utilization list.                                                 */
3608   /***************************************************************************/
3609   evel_json_checkpoint(jbuf);
3610   if (evel_json_open_opt_named_list(jbuf, "codecUsageArray"))
3611   {
3612     bool item_added = false;
3613
3614     item = dlist_get_first(&event->codec_usage);
3615     while (item != NULL)
3616     {
3617       codec_use = (MEASUREMENT_CODEC_USE*) item->item;
3618       assert(codec_use != NULL);
3619
3620       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3621                                           "codecUsageArray",
3622                                           codec_use->codec_id))
3623       {
3624         evel_json_open_object(jbuf);
3625         evel_enc_kv_string(jbuf, "codecIdentifier", codec_use->codec_id);
3626         evel_enc_kv_int(jbuf, "numberInUse", codec_use->number_in_use);
3627         evel_json_close_object(jbuf);
3628         item_added = true;
3629       }
3630       item = dlist_get_next(item);
3631     }
3632     evel_json_close_list(jbuf);
3633
3634     /*************************************************************************/
3635     /* If we've not written anything, rewind to before we opened the list.   */
3636     /*************************************************************************/
3637     if (!item_added)
3638     {
3639       evel_json_rewind(jbuf);
3640     }
3641   }
3642
3643   /***************************************************************************/
3644   /* Additional Measurement Groups list.                                     */
3645   /***************************************************************************/
3646   evel_json_checkpoint(jbuf);
3647   if (evel_json_open_opt_named_list(jbuf, "additionalMeasurements"))
3648   {
3649     bool item_added = false;
3650
3651     item = dlist_get_first(&event->additional_measurements);
3652     while (item != NULL)
3653     {
3654       measurement_group = (MEASUREMENT_GROUP *) item->item;
3655       assert(measurement_group != NULL);
3656
3657       if (!evel_throttle_suppress_nv_pair(jbuf->throttle_spec,
3658                                           "additionalMeasurements",
3659                                           measurement_group->name))
3660       {
3661         evel_json_open_object(jbuf);
3662         evel_enc_kv_string(jbuf, "name", measurement_group->name);
3663         evel_json_open_opt_named_list(jbuf, "arrayOfFields");
3664
3665         /*********************************************************************/
3666         /* Measurements list.                                                */
3667         /*********************************************************************/
3668         nested_item = dlist_get_first(&measurement_group->measurements);
3669         while (nested_item != NULL)
3670         {
3671           custom_measurement = (CUSTOM_MEASUREMENT *) nested_item->item;
3672           assert(custom_measurement != NULL);
3673
3674           evel_json_open_object(jbuf);
3675           evel_enc_kv_string(jbuf, "name", custom_measurement->name);
3676           evel_enc_kv_string(jbuf, "value", custom_measurement->value);
3677           evel_json_close_object(jbuf);
3678           nested_item = dlist_get_next(nested_item);
3679         }
3680         evel_json_close_list(jbuf);
3681         evel_json_close_object(jbuf);
3682         item_added = true;
3683       }
3684       item = dlist_get_next(item);
3685     }
3686     evel_json_close_list(jbuf);
3687
3688     /*************************************************************************/
3689     /* If we've not written anything, rewind to before we opened the list.   */
3690     /*************************************************************************/
3691     if (!item_added)
3692     {
3693       evel_json_rewind(jbuf);
3694     }
3695   }
3696
3697   /***************************************************************************/
3698   /* Although optional, we always generate the version.  Note that this      */
3699   /* closes the object, too.                                                 */
3700   /***************************************************************************/
3701   evel_enc_version(jbuf,
3702                    "measurementsForVfScalingVersion",
3703                    event->major_version,
3704                    event->minor_version);
3705   evel_json_close_object(jbuf);
3706
3707   EVEL_EXIT();
3708 }
3709
3710 /**************************************************************************//**
3711  * Free a Measurement.
3712  *
3713  * Free off the Measurement supplied.  Will free all the contained allocated
3714  * memory.
3715  *
3716  * @note It does not free the Measurement itself, since that may be part of a
3717  * larger structure.
3718  *****************************************************************************/
3719 void evel_free_measurement(EVENT_MEASUREMENT * event)
3720 {
3721   MEASUREMENT_CPU_USE * cpu_use = NULL;
3722   MEASUREMENT_DISK_USE * disk_use = NULL;
3723   MEASUREMENT_FSYS_USE * fsys_use = NULL;
3724   MEASUREMENT_LATENCY_BUCKET * bucket = NULL;
3725   MEASUREMENT_MEM_USE * mem_use = NULL;
3726   MEASUREMENT_VNIC_PERFORMANCE * vnic_performance = NULL;
3727   MEASUREMENT_FEATURE_USE * feature_use = NULL;
3728   MEASUREMENT_CODEC_USE * codec_use = NULL;
3729   MEASUREMENT_GROUP * measurement_group = NULL;
3730   CUSTOM_MEASUREMENT * measurement = NULL;
3731   OTHER_FIELD *addl_info = NULL;
3732   EVEL_JSON_OBJECT * jsonobjp = NULL;
3733
3734   EVEL_ENTER();
3735
3736   /***************************************************************************/
3737   /* Check preconditions.  As an internal API we don't allow freeing NULL    */
3738   /* events as we do on the public API.                                      */
3739   /***************************************************************************/
3740   assert(event != NULL);
3741   assert(event->header.event_domain == EVEL_DOMAIN_MEASUREMENT);
3742
3743   /***************************************************************************/
3744   /* Free all internal strings then the header itself.                       */
3745   /***************************************************************************/
3746   addl_info = dlist_pop_last(&event->additional_info);
3747   while (addl_info != NULL)
3748   {
3749     EVEL_DEBUG("Freeing Additional Info (%s, %s)",
3750                addl_info->name,
3751                addl_info->value);
3752     free(addl_info->name);
3753     free(addl_info->value);
3754     free(addl_info);
3755     addl_info = dlist_pop_last(&event->additional_info);
3756   }
3757
3758   jsonobjp = dlist_pop_last(&event->additional_objects);
3759   while (jsonobjp != NULL)
3760   {
3761     EVEL_DEBUG("Freeing jsonObject %p",jsonobjp);
3762     evel_free_jsonobject( jsonobjp );
3763     jsonobjp = dlist_pop_last(&event->additional_objects);
3764   }
3765
3766   cpu_use = dlist_pop_last(&event->cpu_usage);
3767   while (cpu_use != NULL)
3768   {
3769     EVEL_DEBUG("Freeing CPU use Info (%s)", cpu_use->id);
3770     free(cpu_use->id);
3771     free(cpu_use);
3772     cpu_use = dlist_pop_last(&event->cpu_usage);
3773   }
3774   disk_use = dlist_pop_last(&event->disk_usage);
3775   while (disk_use != NULL)
3776   {
3777     EVEL_DEBUG("Freeing Disk use Info (%s)", disk_use->id);
3778     free(disk_use->id);
3779     free(disk_use);
3780     disk_use = dlist_pop_last(&event->disk_usage);
3781   }
3782   mem_use = dlist_pop_last(&event->mem_usage);
3783   while (mem_use != NULL)
3784   {
3785     EVEL_DEBUG("Freeing Memory use Info (%s)", mem_use->id);
3786     free(mem_use->id);
3787     free(mem_use->vmid);
3788     free(mem_use);
3789     mem_use = dlist_pop_last(&event->mem_usage);
3790   }
3791
3792   fsys_use = dlist_pop_last(&event->filesystem_usage);
3793   while (fsys_use != NULL)
3794   {
3795     EVEL_DEBUG("Freeing Filesystem Use info (%s)", fsys_use->filesystem_name);
3796     free(fsys_use->filesystem_name);
3797     free(fsys_use);
3798     fsys_use = dlist_pop_last(&event->filesystem_usage);
3799   }
3800
3801   bucket = dlist_pop_last(&event->latency_distribution);
3802   while (bucket != NULL)
3803   {
3804     EVEL_DEBUG("Freeing Latency Bucket");
3805     free(bucket);
3806     bucket = dlist_pop_last(&event->latency_distribution);
3807   }
3808
3809   vnic_performance = dlist_pop_last(&event->vnic_usage);
3810   while (vnic_performance != NULL)
3811   {
3812     EVEL_DEBUG("Freeing vNIC performance Info (%s)", vnic_performance->vnic_id);
3813     evel_measurement_free_vnic_performance(vnic_performance);
3814     free(vnic_performance);
3815     vnic_performance = dlist_pop_last(&event->vnic_usage);
3816   }
3817
3818   codec_use = dlist_pop_last(&event->codec_usage);
3819   while (codec_use != NULL)
3820   {
3821     EVEL_DEBUG("Freeing Codec use Info (%s)", codec_use->codec_id);
3822     free(codec_use->codec_id);
3823     free(codec_use);
3824     codec_use = dlist_pop_last(&event->codec_usage);
3825   }
3826
3827   if (event->errors != NULL)
3828   {
3829     EVEL_DEBUG("Freeing Errors");
3830     free(event->errors);
3831   }
3832
3833   feature_use = dlist_pop_last(&event->feature_usage);
3834   while (feature_use != NULL)
3835   {
3836     EVEL_DEBUG("Freeing Feature use Info (%s)", feature_use->feature_id);
3837     free(feature_use->feature_id);
3838     free(feature_use);
3839     feature_use = dlist_pop_last(&event->feature_usage);
3840   }
3841
3842   measurement_group = dlist_pop_last(&event->additional_measurements);
3843   while (measurement_group != NULL)
3844   {
3845     EVEL_DEBUG("Freeing Measurement Group (%s)", measurement_group->name);
3846
3847     measurement = dlist_pop_last(&measurement_group->measurements);
3848     while (measurement != NULL)
3849     {
3850       EVEL_DEBUG("Freeing Measurement (%s)", measurement->name);
3851       free(measurement->name);
3852       free(measurement->value);
3853       free(measurement);
3854       measurement = dlist_pop_last(&measurement_group->measurements);
3855     }
3856     free(measurement_group->name);
3857     free(measurement_group);
3858     measurement_group = dlist_pop_last(&event->additional_measurements);
3859   }
3860
3861   evel_free_header(&event->header);
3862
3863   EVEL_EXIT();
3864 }
3865