Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
PolyORB-HI-C
Commits
68e1ce24
Commit
68e1ce24
authored
Jun 26, 2017
by
yoogx
Browse files
* Activate/deactivate VCD writing at runtime
For openaadl/ocarina#96
parent
705ae151
Changes
1
Hide whitespace changes
Inline
Side-by-side
include/po_hi_utils.h
View file @
68e1ce24
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
*
*
* For more informations, please visit http://taste.tuxfamily.org/wiki
* For more informations, please visit http://taste.tuxfamily.org/wiki
*
*
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-201
4
ESA & ISAE.
* Copyright (C) 2007-2009 Telecom ParisTech, 2010-201
7
ESA & ISAE.
*/
*/
#ifndef __PO_HI_UTILS_H__
#ifndef __PO_HI_UTILS_H__
...
@@ -26,40 +26,55 @@ unsigned long __po_hi_swap_byte (unsigned long value);
...
@@ -26,40 +26,55 @@ unsigned long __po_hi_swap_byte (unsigned long value);
#include <pthread.h>
#include <pthread.h>
#include <string.h>
#include <string.h>
/* Variable keeping track of whether VCD tracing is enabled or not */
#ifdef __PO_HI_USE_VCD
enum
tagVCD
{
VCD_UNCHECKED
,
VCD_DISABLED
,
VCD_ENABLED
}
VCD_state
=
UNCHECKED
;
#endif
void
__po_hi_instrumentation_vcd_init
(
void
);
void
__po_hi_instrumentation_vcd_init
(
void
);
#define __PO_HI_INSTRUMENTATION_VCD_INIT __po_hi_instrumentation_vcd_init ();
#define __PO_HI_INSTRUMENTATION_VCD_INIT __po_hi_instrumentation_vcd_init ();
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...) \
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...) \
{ \
{ \
\
if (VCD_state == VCD_UNCHECKED) { \
extern int __po_hi_vcd_file; \
VCD_state = NULL == getenv("VCD_ENABLED")?VCD_DISABLED:VCD_ENABLED; \
extern int __po_hi_vcd_init;\
} \
extern __po_hi_time_t __po_hi_vcd_start_time; \
if (VCD_state == VCD_ENABLED) { \
extern pthread_mutex_t __po_hi_vcd_mutex; \
extern int __po_hi_vcd_file; \
__po_hi_time_t __po_hi_vcd_current_time; \
extern int __po_hi_vcd_init; \
char buf[1024]; \
extern __po_hi_time_t __po_hi_vcd_start_time; \
int size_to_write = 0; \
extern pthread_mutex_t __po_hi_vcd_mutex; \
uint64_t st,ct,et = 0; \
__po_hi_time_t __po_hi_vcd_current_time; \
\
char buf[1024]; \
pthread_mutex_lock (&__po_hi_vcd_mutex); \
int size_to_write = 0; \
\
uint64_t st,ct,et = 0; \
if (__po_hi_get_time(&__po_hi_vcd_current_time) != __PO_HI_SUCCESS) \
\
{ \
pthread_mutex_lock (&__po_hi_vcd_mutex); \
__DEBUGMSG("[POHIC-INSTRUMENTATION] Could not retrieve time\n"); \
\
} \
if (__po_hi_get_time(&__po_hi_vcd_current_time) != __PO_HI_SUCCESS) \
else \
{ \
{ \
__DEBUGMSG("[POHIC-INSTRUMENTATION] Could not retrieve time\n"); \
st = __PO_HI_TIME_TO_US(__po_hi_vcd_start_time); ct = __PO_HI_TIME_TO_US(__po_hi_vcd_current_time); et = ct - st ; \
} \
memset (buf, '\0', 1024); \
else \
size_to_write = sprintf (buf, "#%llu\n", et); \
{ \
write (__po_hi_vcd_file, buf, size_to_write);\
st = __PO_HI_TIME_TO_US(__po_hi_vcd_start_time); \
\
ct = __PO_HI_TIME_TO_US(__po_hi_vcd_current_time); \
memset (buf, '\0', 1024); \
et = ct - st ; \
size_to_write = sprintf (buf, s, ##args); \
memset (buf, '\0', 1024); \
write (__po_hi_vcd_file, buf, size_to_write); \
size_to_write = sprintf (buf, "#%llu\n", et); \
} \
write (__po_hi_vcd_file, buf, size_to_write); \
pthread_mutex_unlock (&__po_hi_vcd_mutex); \
\
memset (buf, '\0', 1024); \
size_to_write = sprintf (buf, s, ##args); \
write (__po_hi_vcd_file, buf, size_to_write); \
} \
pthread_mutex_unlock (&__po_hi_vcd_mutex); \
}
}
}
#else
#else
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...)
#define __PO_HI_INSTRUMENTATION_VCD_WRITE(s, args...)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment