Shared Persistent Heap Data Environment Manual 1.4.0
sphlflogger.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2010-2014 IBM Corporation.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation, Steven Munroe - initial API and implementation
10 */
11
12#ifndef __SPH_LOCK_FREE_LOGGER_H
13#define __SPH_LOCK_FREE_LOGGER_H
14
165#include "sastype.h"
166#include "sphtimer.h"
167
168
173typedef void *SPHLFLogger_t;
174
176#ifdef __cplusplus
177#define __C__ "C"
178#else
179#define __C__
180#endif
181
183typedef unsigned long longPtr_t;
184
188typedef struct {
190 unsigned int valid : 1;
192 unsigned int timestamped : 1;
194 unsigned int __reserved : 2;
196 unsigned int category : 12;
198 unsigned int subcat : 8;
200 unsigned int len : 8;
202
204typedef unsigned int sphLogEntryID_t;
205
208typedef union {
214
215
217typedef unsigned short sphpid16_t;
218
223typedef struct {
233
234
244typedef struct {
248 char *next;
250 unsigned short int total_size;
252 unsigned short int remaining;
254
264typedef struct {
276 unsigned int options;
278
280#define SPHLFLOGGER_CIRCULAR (1)
282#define SPHLFLOGGER_CIRCULAR_WRAPED (1<<1)
284#define SPHLFLOGGER_CIRCULAR_NOTFIRST (1<<2)
286#define SPHLFLOGGER_CACHE_PREFETCH0 (1<<3)
288#define SPHLFLOGGER_CACHE_PREFETCH1 (1<<4)
290#define SPHLFLOGGER_CIRCULAR_RESETMASK (SPHLFLOGGER_CIRCULAR | \
291 SPHLFLOGGER_CACHE_PREFETCH0 | \
292 SPHLFLOGGER_CACHE_PREFETCH1)
293
306extern __C__ SPHLFLogger_t
307SPHLFLoggerInit (void *buf_seg , block_size_t buf_size);
308
325extern __C__ SPHLFLogger_t
326SPHLFLoggerInitWithStride (void* buf_seg, block_size_t buf_size,
327 unsigned short entry_stride,
328 unsigned int options);
329
340extern __C__ SPHLFLogger_t
341SPHLFLoggerCreate (block_size_t buf_size);
342
355extern __C__ SPHLFLogger_t
356SPHLFCircularLoggerCreate (block_size_t buf_size,
357 unsigned short stride);
358
372extern __C__ void *
374 block_size_t alloc_size);
375
401 int catcode, int subcode,
402 block_size_t alloc_size,
403 SPHLFLoggerHandle_t *handlespace);
404
427 int catcode, int subcode,
428 SPHLFLoggerHandle_t *handlespace);
429
463 int catcode, int subcode,
464 block_size_t alloc_size,
465 SPHLFLoggerHandle_t *handlespace);
466
497 int catcode, int subcode,
498 SPHLFLoggerHandle_t *handlespace);
499
509extern __C__ int
511
518extern __C__ int
520
526extern __C__ int
528
543 SPHLFLoggerHandle_t *handlespace);
544
556 SPHLFLogIterator_t *iteratorSpace);
557
564extern __C__ int
566
573extern __C__ int
575
581extern __C__ block_size_t
583
590extern __C__ int
592
603extern __C__ int
605
613extern __C__ int
615
621extern __C__ int
623
635extern __C__ int
637
643extern __C__ int
645
646#endif /* __SPH_LOCK_FREE_LOGGER_H */
__C__ SPHLFLogger_t SPHLFLoggerInitWithStride(void *buf_seg, block_size_t buf_size, unsigned short entry_stride, unsigned int options)
Initialize a shared storage block as a Lock Free Event Logger with a fixed entry stride.
__C__ int SPHLFLoggerSetCachePrefetch(SPHLFLogger_t log, int prefetch)
Set the cache-line prefetch options for entry allocate.
unsigned int sphLogEntryID_t
Aggregate type for handling sphLogEntryLayout_t.
Definition: sphlflogger.h:204
#define __C__
ignore this macro behined the curtain
Definition: sphlflogger.h:179
__C__ int SPHLFLoggerDestroy(SPHLFLogger_t log)
Destroys the logger and frees the SAS storage for reuse.
void * SPHLFLogger_t
Handle to an instance of SPH Lock Free Logger.
Definition: sphlflogger.h:173
__C__ block_size_t SPHLFLoggerFreeSpace(SPHLFLogger_t log)
Returns the amount of free space (in bytes) remaining in the specified logger.
__C__ int SPHLFLoggerResetIfFullSync(SPHLFLogger_t log)
Resets the specific logger to empty state synchronously if it is currently full.
__C__ int SPHLFLoggerResetAsync(SPHLFLogger_t log)
Resets the specific logger to empty state asynchronously (without locking or atomic updates).
__C__ int SPHLFLoggerPrefetch(SPHLFLogger_t log)
Prefetch pages from the specific logger.
unsigned short sphpid16_t
Common type for PID/TID values stored in Logger entries.
Definition: sphlflogger.h:217
__C__ SPHLFLogger_t SPHLFLoggerCreate(block_size_t buf_size)
Allocate and initialize a shared storage block as a Lock Free Event Logger.
__C__ SPHLFLoggerHandle_t * SPHLFLoggerAllocStrideTimeStamped(SPHLFLogger_t log, int catcode, int subcode, SPHLFLoggerHandle_t *handlespace)
Allocate and initialize the header, of a timestamped logger entry, from the specified logger.
__C__ SPHLFLoggerHandle_t * SPHLFLoggerIteratorNext(SPHLFLogIterator_t *iterator, SPHLFLoggerHandle_t *handlespace)
For the provided Logger Iterator creates a entry handle for the next sequential Logger entry....
__C__ SPHLFLogIterator_t * SPHLFLoggerCreateIterator(SPHLFLogger_t log, SPHLFLogIterator_t *iteratorSpace)
Creates a logger Iterator for reading sequential entries from a specific logger.
unsigned long longPtr_t
unsigned int type, consistent with the size of a pointer and used for pointer calculations
Definition: sphlflogger.h:183
__C__ int SPHLFLoggerEntryIsTimestamped(SPHLFLoggerHandle_t *entryhandle)
Return the status of the entry specified by the entry handle.
__C__ int SPHLFLoggerEntryIsComplete(SPHLFLoggerHandle_t *entryhandle)
Return the status of the entry specified by the entry handle.
__C__ SPHLFLogger_t SPHLFLoggerInit(void *buf_seg, block_size_t buf_size)
Initialize a shared storage block as a Lock Free Event Logger.
__C__ SPHLFLoggerHandle_t * SPHLFLoggerAllocStrideTimeStampedNoLock(SPHLFLogger_t log, int catcode, int subcode, SPHLFLoggerHandle_t *handlespace)
Allocate and initialize the header, of a timestamped logger entry, from the specified logger,...
__C__ int SPHLFLoggerWrapped(SPHLFLogger_t log)
Return the status of the specified logger.
__C__ SPHLFLoggerHandle_t * SPHLFLoggerAllocTimeStamped(SPHLFLogger_t log, int catcode, int subcode, block_size_t alloc_size, SPHLFLoggerHandle_t *handlespace)
Allocate and initialize the header, of a timestamped logger entry, from the specified logger.
__C__ int SPHLFLoggerEmpty(SPHLFLogger_t log)
Return the status of the specified logger.
__C__ int SPHLFLoggerEntryComplete(SPHLFLoggerHandle_t *entryhandle)
Marks the entry specified by the entry handle as complete.
__C__ SPHLFLoggerHandle_t * SPHLFLoggerAllocTimeStampedNoLock(SPHLFLogger_t log, int catcode, int subcode, block_size_t alloc_size, SPHLFLoggerHandle_t *handlespace)
Allocate and initialize the header of a timestamped logger entry from the specified logger,...
__C__ void * SPHLFLoggerAllocRaw(SPHLFLogger_t log, block_size_t alloc_size)
Return the address of a (raw) Logger entry allocated from the specified logger.
__C__ int SPHLFLoggerFull(SPHLFLogger_t log)
Return the status of the specified logger.
__C__ SPHLFLogger_t SPHLFCircularLoggerCreate(block_size_t buf_size, unsigned short stride)
Allocate and initialize a shared storage block as a Lock Free Event Logger. Mark the logger as circul...
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
Instance of a Lock Free Logger Entry Header.
Definition: sphlflogger.h:223
sphtimer_t timeStamp
Definition: sphlflogger.h:231
sphpid16_t TID
Definition: sphlflogger.h:229
sphLogEntry_t entryID
Definition: sphlflogger.h:225
sphpid16_t PID
Definition: sphlflogger.h:227
Instance of a Lock Free Logger Iterator.
Definition: sphlflogger.h:264
longPtr_t current
Definition: sphlflogger.h:268
SPHLFLogger_t logger
Definition: sphlflogger.h:266
unsigned int options
Definition: sphlflogger.h:276
longPtr_t start_log
Definition: sphlflogger.h:272
longPtr_t end_log
Definition: sphlflogger.h:274
longPtr_t free
Definition: sphlflogger.h:270
Instance of a Lock Free Logger Entry Handle.
Definition: sphlflogger.h:244
unsigned short int total_size
Definition: sphlflogger.h:250
unsigned short int remaining
Definition: sphlflogger.h:252
char * next
Definition: sphlflogger.h:248
SPHLFLogHeader_t * entry
Definition: sphlflogger.h:246
sphLogEntry_t. Fields defining the entry details word.
Definition: sphlflogger.h:188
unsigned int subcat
Definition: sphlflogger.h:198
unsigned int timestamped
Definition: sphlflogger.h:192
unsigned int category
Definition: sphlflogger.h:196
unsigned int len
Definition: sphlflogger.h:200
unsigned int valid
Definition: sphlflogger.h:190
unsigned int __reserved
Definition: sphlflogger.h:194
Union of Entry details with 32-bit word for atomic update.
Definition: sphlflogger.h:208
sphLogEntryID_t idUnit
Definition: sphlflogger.h:210
sphLogEntryLayout_t detail
Definition: sphlflogger.h:212