source: proiecte/hpl/openmpi_compiled/include/vampirtrace/OTF_WBuffer.h @ 97

Last change on this file since 97 was 97, checked in by (none), 14 years ago

Adding compiled files

File size: 4.1 KB
Line 
1/*
2 This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2008.
3 Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch
4*/
5
6/**
7 *  @file OTF_WBuffer.h
8 *
9 *  @brief Provides write access to trace buffers.
10 *
11 *  \ingroup internal
12 */
13
14
15#ifndef OTF_WBUFFER_H
16#define OTF_WBUFFER_H
17
18
19#include <stdlib.h>
20#include <stdio.h>
21
22
23#include "OTF_inttypes.h"
24
25
26#include "OTF_File.h"
27#include "OTF_Filenames.h"
28
29
30#ifdef __cplusplus
31extern "C" {
32#endif /* __cplusplus */
33
34struct struct_OTF_WBuffer {
35
36
37        OTF_File* file;
38
39
40        /**     Begin of the actual buffer. */
41        char* buffer;
42
43        /**     Current size of buffer. */
44        uint32_t size;
45
46        /**     Next write position in buffer. */
47        uint32_t pos;
48
49        /**     Current process inside this file buffer, necessary for state
50                machine. This must not be part of OTF_WStream because there are
51                multiple buffers per stream that might be written in parallel. */
52        uint32_t process;
53
54        /**     Current time inside this file buffer, necessary for state machine.
55                This must not be part of OTF_WStream because there are multiple
56                buffers per stream that might be written in parallel. */
57        uint64_t time;
58       
59#ifdef HAVE_ZLIB
60        /** Default size of zbuffers managed by this buffer. */
61        uint32_t zbuffersize;
62#endif /* HAVE_ZLIB */
63};
64typedef struct struct_OTF_WBuffer OTF_WBuffer;
65
66
67/**     Constructor - internal use only */
68OTF_WBuffer* OTF_WBuffer_open( const char* filename, OTF_FileManager* manager );
69
70/**     Destructor - internal use only */
71int OTF_WBuffer_close( OTF_WBuffer* wbuffer );
72
73/**     Set the size of the buffer. Cannot shrink buffer but only extend. */
74int OTF_WBuffer_setSize( OTF_WBuffer* wbuffer, size_t size );
75
76/**     Set the size of the zbuffer. */
77void OTF_WBuffer_setZBufferSize( OTF_WBuffer* wbuffer, uint32_t size );
78
79/**     Writes the buffer contents to 'file' and marks the buffer empty again. */
80int OTF_WBuffer_flush( OTF_WBuffer* wbuffer );
81
82/**     Ask the buffer to guarantee at least 'space' bytes at current writing
83        position before the next flush is necessary. Return 1 on success. */
84int OTF_WBuffer_guarantee( OTF_WBuffer* wbuffer, size_t space );
85
86
87/**     Set process state machine to 'p' and time stamp state machine to 't'.
88        If 'p' is the current process and 't' is the current time stamp nothing
89        is done. If the process has changed a process record will be written.
90        If the time has changed the new time stamp and the current process will
91        be written. If 't' is lower than the current time stamp
92        it is regarded as an error. Return != 1 on success and 0 on error. */
93int OTF_WBuffer_setTimeAndProcess( OTF_WBuffer* wbuffer, 
94        uint64_t t, uint32_t p );
95
96/* *** basic write operations *** */
97
98/**     Append a key word to the write buffer. A key word is a string without
99        quotes. Buffer flush is done if necessary. Return the number of bytes
100        written. */
101uint32_t OTF_WBuffer_writeKeyword( OTF_WBuffer* wbuffer, const char* keyword );
102
103/**     Append a string to the write buffer. A string is surrounded by quotes.
104        Buffer flush is done if necessary. Return the number of bytes written. */
105uint32_t OTF_WBuffer_writeString( OTF_WBuffer* wbuffer, const char* string );
106
107/**     Append a char to the write buffer. Buffer flush is done if necessary.
108        Return the number of bytes written (=1). */
109uint32_t OTF_WBuffer_writeChar( OTF_WBuffer* wbuffer, const char character );
110
111/**     This function append an unsigned integer 'value' in hex format to
112        the write buffer. Buffer flush is done if necessary. The return value
113        is the number of written characters. */
114uint32_t OTF_WBuffer_writeUint32( OTF_WBuffer* wbuffer, uint32_t value );
115
116/**     This function append an 64bit unsigned integer 'value' in hex format to
117        the write buffer. Buffer flush is done if necessary. The return value
118        is the number of written characters. */
119uint32_t OTF_WBuffer_writeUint64( OTF_WBuffer* wbuffer, uint64_t value );
120
121/**     Append a newline character to the buffer. Buffer flush is done if
122        necessary. Return the number of bytes written. */
123uint32_t OTF_WBuffer_writeNewline( OTF_WBuffer* wbuffer );
124
125/** internal use */
126OTF_WBuffer* OTF_WBuffer_open_zlevel( const char* filename,
127        OTF_FileManager* manager, OTF_FileCompression compression );
128
129#ifdef __cplusplus
130}
131#endif /* __cplusplus */
132
133#endif /* OTF_WBUFFER_H */
134
Note: See TracBrowser for help on using the repository browser.