12 #ifndef __SPH_LOCK_FREE_ENTRY_H
13 #define __SPH_LOCK_FREE_ENTRY_H
61 unsigned int valid : 1;
63 unsigned int timestamped : 1;
65 unsigned int allocated : 1;
67 unsigned int __reserved : 1;
69 unsigned int category : 12;
71 unsigned int subcat : 8;
254 result = entryPtr->
PID;
273 result = entryPtr->
TID;
307 printf (
"SPHLFEntryCategory(%p) entry=%p id=%x\n",
328 printf (
"SPHLFEntrySubcat(%p) entry=%p id=%x\n",
355 char *ptr = handle->
next;
362 #define SPHENTRYGETSTRUCTPTR(__handle, __struct) SPHLFEntryGetStructPtr(__handle, sizeof(__struct), __alignof__(__struct))
385 unsigned long __size,
unsigned long __align)
387 char *ptr = (
char*)handle->
next;
389 unsigned long adjust = __align - 1;
390 unsigned long mask = ~adjust;
393 ((((
unsigned long)ptr)
397 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
399 len -= ((
unsigned long)ptr
400 - (
unsigned long)handle->
next);
405 handle->
next = ptr + __size;
415 #define SPHENTRYALLOCSTRUCT(__handle, __struct) SPHLFEntryAllocStruct(__handle, sizeof(__struct), __alignof__(__struct))
440 unsigned long __size,
unsigned long __align)
442 char *ptr = (
char*)handle->
next;
444 unsigned long adjust = __align - 1;
445 unsigned long mask = ~adjust;
448 ((((
unsigned long)ptr)
452 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
454 len -= ((
unsigned long)ptr
455 - (
unsigned long)handle->
next);
460 handle->
next = ptr + __size;
480 char *ptr = handle->
next;
481 unsigned short int len = handle->
remaining;
482 int vlen = (strlen(value) + 1);
510 char *ptr = handle->
next;
511 unsigned short int len = handle->
remaining;
514 if (len >=
sizeof(
char))
518 handle->
next = (
char*)ptr;
538 short int *ptr = (
short int*)handle->
next;
539 unsigned short int len = handle->
remaining;
541 unsigned long adjust = __alignof__(
short int) -1;
542 unsigned long mask = ~adjust;
545 ((((
unsigned long)ptr)
549 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
551 len -= ((
unsigned long)ptr
552 - (
unsigned long)handle->
next);
555 if (len >=
sizeof(
short int))
558 len -=
sizeof(short);
559 handle->
next = (
char*)ptr;
579 int *ptr = (
int*)handle->
next;
580 unsigned short int len = handle->
remaining;
583 ptr = (
int*)(((((
unsigned long)ptr))
584 + (__alignof__(
int) -1))
585 & (~(__alignof__(
int) -1)));
587 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
589 len -= ((
unsigned long)ptr
590 - (
unsigned long)handle->
next);
593 if (len >=
sizeof(
int))
597 handle->
next = (
char*)ptr;
617 long *ptr = (
long*)handle->
next;
618 unsigned short int len = handle->
remaining;
621 ptr = (
long*)(((((
unsigned long)ptr))
622 + (__alignof__(
long) -1))
623 & (~(__alignof__(
long) -1)));
625 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
627 len -= ((
unsigned long)ptr
628 - (
unsigned long)handle->
next);
631 if (len >=
sizeof(
long))
635 handle->
next = (
char*)ptr;
655 void **ptr = (
void**)handle->
next;
656 unsigned short int len = handle->
remaining;
659 ptr = (
void**)(((((
unsigned long)ptr))
660 + (__alignof__(
void*) -1))
661 & (~(__alignof__(
void*) -1)));
663 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
665 len -= ((
unsigned long)ptr
666 - (
unsigned long)handle->
next);
669 if (len >=
sizeof(
void*))
672 len -=
sizeof(
void*);
673 handle->
next = (
char*)ptr;
693 long long *ptr = (
long long*)handle->
next;
694 unsigned short int len = handle->
remaining;
697 ptr = (
long long*)(((((
unsigned long)ptr))
698 + (__alignof__(
long long) -1))
699 & (~(__alignof__(
long long) -1)));
701 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
703 len -= ((
unsigned long)ptr
704 - (
unsigned long)handle->
next);
707 if (len >=
sizeof(
long long))
710 len -=
sizeof(
long long);
711 handle->
next = (
char*)ptr;
731 float *ptr = (
float*)handle->
next;
732 unsigned short int len = handle->
remaining;
735 ptr = (
float*)(((((
unsigned long)ptr))
736 + (__alignof__(
float) -1))
737 & (~(__alignof__(
float) -1)));
739 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
741 len -= ((
unsigned long)ptr
742 - (
unsigned long)handle->
next);
745 if (len >=
sizeof(
float))
748 len -=
sizeof(float);
749 handle->
next = (
char*)ptr;
769 double *ptr = (
double*)handle->
next;
770 unsigned short int len = handle->
remaining;
773 ptr = (
double*)(((((
unsigned long)ptr))
774 + (__alignof__(
double) -1))
775 & (~(__alignof__(
double) -1)));
777 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
779 len -= ((
unsigned long)ptr
780 - (
unsigned long)handle->
next);
783 if (len >=
sizeof(
double))
786 len -=
sizeof(double);
787 handle->
next = (
char*)ptr;
806 char *ptr = handle->
next;
807 unsigned short int len = handle->
remaining;
810 if (len >=
sizeof(
char))
814 handle->
next = (
char*)ptr;
831 char *ptr = handle->
next;
832 unsigned short int len = handle->
remaining;
833 int vlen = (strlen(ptr) + 1);
856 static inline short int
859 short int *ptr = (
short int*)handle->
next;
860 unsigned short int len = handle->
remaining;
861 unsigned long adjust = __alignof__(
short int) -1;
862 unsigned long mask = ~adjust;
866 ((((
unsigned long)ptr)
870 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
872 len -= ((
unsigned long)ptr
873 - (
unsigned long)handle->
next);
876 if (len >=
sizeof(
short int))
879 len -=
sizeof(short);
880 handle->
next = (
char*)ptr;
898 int *ptr = (
int*)handle->
next;
899 unsigned short int len = handle->
remaining;
902 ptr = (
int*)(((((
unsigned long)ptr))
903 + (__alignof__(
int) -1))
904 & (~(__alignof__(
int) -1)));
906 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
908 len -= ((
unsigned long)ptr
909 - (
unsigned long)handle->
next);
912 if (len >=
sizeof(
int))
916 handle->
next = (
char*)ptr;
934 long *ptr = (
long*)handle->
next;
935 unsigned short int len = handle->
remaining;
938 ptr = (
long*)(((((
unsigned long)ptr))
939 + (__alignof__(
long) -1))
940 & (~(__alignof__(
long) -1)));
942 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
944 len -= ((
unsigned long)ptr
945 - (
unsigned long)handle->
next);
948 if (len >=
sizeof(
long))
952 handle->
next = (
char*)ptr;
970 void **ptr = (
void**)handle->
next;
971 unsigned short int len = handle->
remaining;
974 ptr = (
void**)(((((
unsigned long)ptr))
975 + (__alignof__(
void*) -1))
976 & (~(__alignof__(
void*) -1)));
978 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
980 len -= ((
unsigned long)ptr
981 - (
unsigned long)handle->
next);
984 if (len >=
sizeof(
void*))
987 len -=
sizeof(
void*);
988 handle->
next = (
char*)ptr;
1003 static inline long long
1006 long long *ptr = (
long long*)handle->
next;
1007 unsigned short int len = handle->
remaining;
1008 long long value = 0LL;
1010 ptr = (
long long*)(((((
unsigned long)ptr))
1011 + (__alignof__(
long long) -1))
1012 & (~(__alignof__(
long long) -1)));
1014 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
1016 len -= ((
unsigned long)ptr
1017 - (
unsigned long)handle->
next);
1020 if (len >=
sizeof(
long long))
1023 len -=
sizeof(
long long);
1024 handle->
next = (
char*)ptr;
1042 float *ptr = (
float*)handle->
next;
1043 unsigned short int len = handle->
remaining;
1046 ptr = (
float*)(((((
unsigned long)ptr))
1047 + (__alignof__(
float) -1))
1048 & (~(__alignof__(
float) -1)));
1050 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
1052 len -= ((
unsigned long)ptr
1053 - (
unsigned long)handle->
next);
1056 if (len >=
sizeof(
float))
1059 len -=
sizeof(float);
1060 handle->
next = (
char*)ptr;
1075 static inline double
1078 double *ptr = (
double*)handle->
next;
1079 unsigned short int len = handle->
remaining;
1082 ptr = (
double*)(((((
unsigned long)ptr))
1083 + (__alignof__(
double) -1))
1084 & (~(__alignof__(
double) -1)));
1086 if ((
unsigned long)ptr != (
unsigned long)handle->
next)
1088 len -= ((
unsigned long)ptr
1089 - (
unsigned long)handle->
next);
1092 if (len >=
sizeof(
double))
1095 len -=
sizeof(double);
1096 handle->
next = (
char*)ptr;
static double SPHLFEntryGetNextDouble(SPHLFEntryHandle_t *handle)
Return the next double from the entry via the current next value pointer. Leading bytes may be skippe...
Definition: sphlfentry.h:1076
static long long SPHLFEntryGetNextLongLong(SPHLFEntryHandle_t *handle)
Return the next long long int from the entry via the current next value pointer. Leading bytes may be...
Definition: sphlfentry.h:1004
static int SPHLFEntryStrongComplete(SPHLFEntryHandle_t *handlespace)
Marks the entry specified by the entry handle as complete. Also executes any memory barriers required...
Definition: sphlfentry.h:135
#define sas_write_barrier()
Definition: sasatom.h:51
static void * SPHLFEntryGetFreePtr(SPHLFEntryHandle_t *handle)
Return the first free byte address for the entry specified by the entry handle.
Definition: sphlfentry.h:353
static int SPHLFEntryIsTimestamped(SPHLFEntryHandle_t *handlespace)
Return the status of the entry specified by the entry handle.
Definition: sphlfentry.h:213
unsigned long longPtr_t
unsigned int type, consistent with the size of a pointer and used for pointer calculations ...
Definition: sphlfentry.h:55
Functions to access the Time Base register (PPC) or clock_gettime(CLOCK_MONOTONIC) measure time at hi...
unsigned long long int sphtimer_t
Value from TB/TSC register (64-bits on all platforms).
Definition: sphtimer.h:66
sphLFEntryID_t idUnit
Definition: sphlfentry.h:83
static int SPHLFEntryWeakComplete(SPHLFEntryHandle_t *handlespace)
Marks the entry specified by the entry handle as complete. No memory barriers are performance...
Definition: sphlfentry.h:158
unsigned short sphpid16_t
Common type for PID/TID values stored in event entries.
Definition: sphlfentry.h:89
Type and functions for SAS atomic operations.
Instance of a Lock Free event data Entry Handle.
Definition: sphlfentry.h:115
static void * SPHLFEntryGetNextPtr(SPHLFEntryHandle_t *handle)
Return the next void* from the entry via the current next value pointer. Leading bytes may be skipped...
Definition: sphlfentry.h:968
unsigned short int total_size
Definition: sphlfentry.h:121
static int SPHLFEntryGetNextInt(SPHLFEntryHandle_t *handle)
Return the next int from the entry via the current next value pointer. Leading bytes may be skipped t...
Definition: sphlfentry.h:896
static void * SPHLFEntryGetStructPtr(SPHLFEntryHandle_t *handle, unsigned long __size, unsigned long __align)
Return the correctly aligned pointer for a struct or array starting at the next free location within ...
Definition: sphlfentry.h:384
static long SPHLFEntryGetNextLong(SPHLFEntryHandle_t *handle)
Return the next long int from the entry via the current next value pointer. Leading bytes may be skip...
Definition: sphlfentry.h:932
static int SPHLFEntryAddInt(SPHLFEntryHandle_t *handle, int value)
Insert a int at the next free location within the entry.
Definition: sphlfentry.h:576
static SPHLFEntryHeader_t * SPHLFEntryHeader(SPHLFEntryHandle_t *handlespace)
Return the address for the entry header specified by the entry handle.
Definition: sphlfentry.h:285
Fields defining the entry header details word.
Definition: sphlfentry.h:59
SPHLFEntryHeader_t * entry
Definition: sphlfentry.h:117
static int SPHLFEntryCategory(SPHLFEntryHandle_t *handlespace)
Return the entry category for the entry specified by the entry handle.
Definition: sphlfentry.h:302
static int SPHLFEntryAddLong(SPHLFEntryHandle_t *handle, long value)
Insert a long int at the next free location within the entry.
Definition: sphlfentry.h:614
unsigned short sphpid16_t
Common type for PID/TID values stored in Logger entries.
Definition: sphlflogger.h:217
unsigned int timestamped
Definition: sphlfentry.h:63
static int SPHLFEntryAddFloat(SPHLFEntryHandle_t *handle, float value)
Insert a float at the next free location within the entry.
Definition: sphlfentry.h:728
static int SPHLFEntryComplete(SPHLFEntryHandle_t *handlespace)
Marks the entry specified by the entry handle as complete. Also executes write memory barries require...
Definition: sphlfentry.h:179
static short int SPHLFEntryGetNextShort(SPHLFEntryHandle_t *handle)
Return the next short int from the entry via the current next value pointer. Leading bytes may be ski...
Definition: sphlfentry.h:857
char * next
Definition: sphlfentry.h:119
static int SPHLFEntryAddDouble(SPHLFEntryHandle_t *handle, double value)
Insert a double at the next free location within the entry.
Definition: sphlfentry.h:766
static void * SPHLFEntryAllocStruct(SPHLFEntryHandle_t *handle, unsigned long __size, unsigned long __align)
Allocate space for struct starting at the next free location within the entry.
Definition: sphlfentry.h:439
static int SPHLFEntryAddShort(SPHLFEntryHandle_t *handle, short int value)
Insert a short int at the next free location within the entry.
Definition: sphlfentry.h:535
static sphpid16_t SPHLFEntryTID(SPHLFEntryHandle_t *handlespace)
Return the thread ID for the entry specified by the entry handle.
Definition: sphlfentry.h:266
#define sas_read_barrier()
Definition: sasatom.h:56
static int SPHLFEntrySubcat(SPHLFEntryHandle_t *handlespace)
Return the entry sub-category for the entry specified by the entry handle.
Definition: sphlfentry.h:323
sphLFEntryLayout_t detail
Definition: sphlfentry.h:85
static float SPHLFEntryGetNextFloat(SPHLFEntryHandle_t *handle)
Return the next float from the entry via the current next value pointer. Leading bytes may be skipped...
Definition: sphlfentry.h:1040
static int SPHLFEntryAddChar(SPHLFEntryHandle_t *handle, char value)
Insert a character at the next free location within the entry.
Definition: sphlfentry.h:507
static int SPHLFEntryIsComplete(SPHLFEntryHandle_t *handlespace)
Return the status of the entry specified by the entry handle.
Definition: sphlfentry.h:200
unsigned int sphLFEntryID_t
Aggregate type for handling sphLogEntryLayout_t.
Definition: sphlfentry.h:77
static int SPHLFEntryAddPtr(SPHLFEntryHandle_t *handle, void *value)
Insert a void* at the next free location within the entry.
Definition: sphlfentry.h:652
static char * SPHLFEntryGetNextString(SPHLFEntryHandle_t *handle)
Return the pointer to the next C string from the logger entry via the current next value pointer...
Definition: sphlfentry.h:829
Union of Entry details with 32-bit word for atomic update.
Definition: sphlfentry.h:81
static int SPHLFEntryAddLongLong(SPHLFEntryHandle_t *handle, long long value)
Insert a long long int at the next free location within the entry.
Definition: sphlfentry.h:690
unsigned int subcat
Definition: sphlfentry.h:71
static sphpid16_t SPHLFEntryPID(SPHLFEntryHandle_t *handlespace)
Return the process ID for the entry specified by the entry handle.
Definition: sphlfentry.h:247
static int SPHLFEntryAddString(SPHLFEntryHandle_t *handle, char *value)
Insert a C string at the next free location within the entry.
Definition: sphlfentry.h:477
unsigned int category
Definition: sphlfentry.h:69
static sphtimer_t SPHLFEntryTimeStamp(SPHLFEntryHandle_t *handlespace)
Return the time stamp value for the entry specified by the entry handle.
Definition: sphlfentry.h:228
unsigned int valid
Definition: sphlfentry.h:61
unsigned short int remaining
Definition: sphlfentry.h:123
static char SPHLFEntryGetNextChar(SPHLFEntryHandle_t *handle)
Return the next char from the entry via the current next value pointer. The internal next value point...
Definition: sphlfentry.h:804