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