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

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

Adding compiled files

File size: 41.2 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_Writer.h
8 *
9 *  @brief Transparently writes OTF traces which consist of multiple streams.
10 *
11 * \ingroup writer
12 */
13
14/** \defgroup writer Writer Interface
15 *
16 *  This interface should be used whenever a trace file is to be written as a
17 *  whole.  Therefore, an initial call to the OTF_Writer_open() function
18 *  allows to specify a number of streams which are going to be used to
19 *  automatically partition the recorded event data. OTF than takes over the
20 *  duty of distributing the data on multiple files.
21 *
22 *  \section writer_example A simple Example
23 *
24 *  \code
25 *  #include <assert.h>
26 *  #include "otf.h"
27 *
28 *  int main( int argc, char** argv ) {
29 *  \endcode
30 *
31 *      Declare a file manager and a writer.
32 *      \code
33 *          OTF_FileManager* manager;
34 *          OTF_Writer* writer;
35 *          \endcode
36 *
37 *      Initialize the file manager. Open at most 100 OS files.
38 *      \code
39 *      manager= OTF_FileManager_open( 100 );
40 *          assert( manager );
41 *          \endcode
42 *
43 *          Initialize the writer. Open file "test", writing one stream.
44 *          \code
45 *          writer = OTF_Writer_open( "test", 1, manager );
46 *      assert( writer );
47 *      \endcode
48 *     
49 *      Write some important Definition Records.
50 *      Have a look at the specific functions to see what the parameters mean.
51 *      \code
52 *      OTF_Writer_writeDefTimerResolution( writer, 0, 1000 );
53 *      OTF_Writer_writeDefProcess( writer, 0, 1, "proc one", 0 );
54 *      OTF_Writer_writeDefFunctionGroup( writer, 0, 1000, "all functions" );
55 *      OTF_Writer_writeDefFunction( writer, 0, 1, "main", 1000, 0 );
56 *      \endcode
57 *
58 *
59 *      Write an enter and a leave record.
60 *      time = 10000, 20000
61 *      process = 1
62 *      function = 1
63 *      Sourcecode location doesn't matter, so it's zero.
64 *      \code
65 *      OTF_Writer_writeEnter( writer, 10000, 1, 1, 0 );
66 *      OTF_Writer_writeLeave( writer, 20000, 1, 1, 0 );
67 *      \endcode
68 *
69 *      Clean up before exiting the program.
70 *      \code
71 *      OTF_Writer_close( writer );
72 *      OTF_FileManager_close( manager );
73 *
74 *              return 0;
75 * }
76 * \endcode
77 *
78 * Compile this using $ gcc -o test test.c `otfconfig --libs`.
79 *
80 */
81
82#ifndef OTF_WRITER_H
83#define OTF_WRITER_H
84
85
86#include "OTF_MasterControl.h"
87#include "OTF_FileManager.h"
88#include "OTF_WBuffer.h"
89#include "OTF_WStream.h"
90
91
92#ifdef __cplusplus
93extern "C" {
94#endif /* __cplusplus */
95
96/** writer object \ingroup writer */
97typedef struct struct_OTF_Writer OTF_Writer;
98
99/* *** public member functions *** */
100
101
102/**     
103 * Create a new OTF_Writer instance with a given number of automatic streams.
104 *
105 * Setting the number of streams to 0 causes the OTF_Writer object to create a
106 * separate stream for each process. Important! Explicit calls to
107 * OTF_Writer_assignProcess() can lead to an overall number of streams which
108 * exceeds the initial number of streams in this call.
109 * OTF can reduce its file handle usage to a given number. Therefore, an
110 * initialized file manager instance is needed as parameter.
111 * See OTF_FileManager for further details.
112 *
113 * @param  fileNamePrefix   File name prefix which is going to be used by
114 *                          all sub-files which belong to the trace.
115 * @param  numberOfStreams  Initial number of independent data streams to
116 *                          be generated.
117 * @param  fileManager      File handle manager.
118 *
119 *
120 * @return                  Initialized OTF_Writer instance or 0 if a failure
121 *                          occurred.
122 *
123 * \ingroup writer
124 */
125OTF_Writer* OTF_Writer_open( const char* fileNamePrefix, 
126                             uint32_t numberOfStreams, 
127                             OTF_FileManager* fileManager );
128
129
130/**
131 * Close an OTF_Writer instance and all its related files.
132 *
133 * @param writer  Pointer to an initialized OTF_Writer object. See
134 *                also OTF_Writer_open().
135 *
136 * @return        1 if instance was closed successfully and 0 otherwise.       
137 *
138 * \ingroup writer
139 */
140int OTF_Writer_close( OTF_Writer* writer );
141
142
143/**
144 * Close all streams that are open in this writer instance.
145 *
146 * @param writer  Pointer to an initialized OTF_Writer object. See
147 *                also OTF_Writer_open().
148 *
149 * @return        1 on success, 0 if an error occurs.
150 *
151 * \ingroup writer
152 */
153int OTF_Writer_closeAllStreams( OTF_Writer* writer );
154
155
156/**
157 * Set the standard compression method for all buffers managed by this writer
158 *
159 * @param writer       Pointer to an initialized OTF_Writer object. See
160 *                     also OTF_Writer_open().
161 *
162 * @param compression  compression level to apply to all following streams
163 *                     0-9, where 0 means no compression is applied, and 9 is
164 *                     the highest level of compression.
165 *
166 * @return             1 on success, 0 if an error occurs.
167 *
168 * \ingroup writer
169 */
170int OTF_Writer_setCompression( OTF_Writer* writer, OTF_FileCompression
171        compression );
172
173       
174/**
175 * Return the standard compression method for all buffers managed by this writer
176 *
177 * @param writer       Pointer to an initialized OTF_Writer object. See
178 *                     also OTF_Writer_open().
179 *
180 * @return             Standard compression level for all buffers managed by
181 *                     this writer.
182 *
183 * \ingroup writer
184 */
185OTF_FileCompression OTF_Writer_getCompression( OTF_Writer* writer );
186
187
188/**
189 * Set the default buffer size for all buffers managed by this Writer.
190 * This is only effective for future buffers and will not change already
191 * allocated buffers. Those can be changed with the buffers directly.
192 *
193 * @param writer  Pointer to an initialized OTF_Writer object. See
194 *                also OTF_Writer_open().
195 *
196 * @param size    Intended buffer size.
197 *
198 * \ingroup writer
199 */
200void OTF_Writer_setBufferSizes( OTF_Writer* writer, uint32_t size );
201
202
203/**
204 * Get the default buffer size for all buffers managed by this Writer.
205 *
206 * @param writer  Pointer to an initialized OTF_Writer object. See
207 *                also OTF_Writer_open().
208 *
209 * @return        Default buffer size for all buffers managed by this Writer.
210 *
211 * \ingroup writer
212 */
213uint32_t OTF_Writer_getBufferSizes( OTF_Writer* writer );
214
215
216/**
217 * Set the default zbuffer size for all buffers managed by this Reader.
218 * This is only effective for future files and will not change already
219 * allocated zbuffers. Those can be changed with the files directly.
220 *
221 * @param writer  Pointer to an initialized OTF_Writer object. See
222 *                also OTF_Writer_open().
223 *
224 * @param size    Intended zbuffer size.
225 *
226 * \ingroup writer
227 */
228void OTF_Writer_setZBufferSizes( OTF_Writer* writer, uint32_t size );
229
230/**
231 * Get the default zbuffer size.
232 *
233 * @param writer  Pointer to an initialized OTF_Writer object. See
234 *                also OTF_Writer_open().
235 *
236 * @return  zbuffer size.
237 *
238 * \ingroup writer
239 */
240uint32_t OTF_Writer_getZBufferSizes( OTF_Writer* writer );
241
242/**
243 * Set the default ouput format. The format is applied to all streams opened by
244 * the writer.
245 *
246 * @param writer  Pointer to an initialized OTF_Writer object. See
247 *                also OTF_Writer_open().
248 *
249 * @param format  Intended output format (OTF_WSTREAM_FORMAT_{LONG,SHORT}).
250 *
251 * \ingroup writer
252 */
253void OTF_Writer_setFormat( OTF_Writer* writer, uint32_t format );
254
255
256/**
257 * Get the default output format of all streams managed by this writer.
258 *
259 * @param writer  Pointer to an initialized OTF_Writer object. See
260 *                also OTF_Writer_open().
261 *
262 * @return        Default output format.
263 *
264 * \ingroup writer
265 */
266uint32_t OTF_Writer_getFormat( OTF_Writer* writer );
267
268
269/**     
270 * Explicitly assign a given process to a specific stream.
271 *
272 * Mind that 0 is not a valid stream or process identifier but a reserved
273 * value. By default, processes are automatically assigned to streams.
274 * Therefore, this call is optional.
275 *
276 * @param writer   Pointer to an initialized OTF_Writer object. See
277 *                 also OTF_Writer_open().
278 * @param process  Process identifier. See also OTF_Writer_writeDefProcess().
279 * @param stream   Target stream identifier with
280 *                 0 < stream <= number of streams as defined in
281 *                 OTF_Writer_open().
282 *
283 * @return         1 on success, 0 if an error occurs.
284 *
285 * \ingroup writer
286 */
287uint32_t OTF_Writer_assignProcess( OTF_Writer* writer,
288                                   uint32_t process, 
289                                   uint32_t stream );
290
291
292/**
293 * Get a pointer to the master control object of the given writer instance.
294 *
295 * @param writer   Pointer to an initialized OTF_Writer object. See
296 *                 also OTF_Writer_open().
297 *
298 * @return         Pointer to a master control object. See OTF_MasterControl.
299 *
300 * \ingroup writer
301 */
302OTF_MasterControl* OTF_Writer_getMasterControl( OTF_Writer* writer );
303
304
305/**
306 * Set an alternative master control object. Use this only right after
307 * initialization but never after having written some records already!
308 *
309 * @param writer   Pointer to an initialized OTF_Writer object. See
310 *                 also OTF_Writer_open().
311 * @param mc       new master control object
312 *                 
313 *
314 * \ingroup writer
315 */
316void OTF_Writer_setMasterControl( OTF_Writer* writer, OTF_MasterControl* mc );
317
318
319/* Methods for writing public definition records ************************** */
320
321
322/**
323 * Write a comment record.
324 *
325 * @param writer    Initialized OTF_Writer instance.
326 * @param stream    Target stream identifier with
327 *                  0 < stream <= number of streams as defined in
328 *                  OTF_Writer_open().
329 * @param comment   Arbitrary comment string.
330 *
331 * @return          1 on success, 0 if an error occurs.       
332 *
333 * \ingroup writer
334 */
335int OTF_Writer_writeDefinitionComment( OTF_Writer* writer, 
336                                       uint32_t stream, 
337                                       const char* comment );
338
339
340/**
341 * Write the timer resolution definition record. All timed event records
342 * will be interpreted according to this definition. By default, a timer
343 * resultion of 1 us i.e. 1,000,000 clock ticks is assumed.
344 *
345 * @param writer          Pointer to an initialized OTF_Writer object. See
346 *                        also OTF_Writer_open().
347 * @param stream          Target stream identifier with
348 *                        0 < stream <= number of streams as defined in
349 *                        OTF_Writer_open().
350 * @param ticksPerSecond  Clock ticks per second of the timer.
351 *
352 * @return                1 on success, 0 if an error occurs.       
353 *
354 * \ingroup writer
355 */
356int OTF_Writer_writeDefTimerResolution( OTF_Writer* writer, 
357                                        uint32_t stream,
358                                        uint64_t ticksPerSecond );
359
360
361/**
362 * Write a process definition record.
363 *
364 * @param writer   Pointer to an initialized OTF_Writer object. See
365 *                 also OTF_Writer_open().
366 * @param stream   Target stream identifier with
367 *                 0 < stream <= number of streams as defined in
368 *                 OTF_Writer_open().
369 * @param process  Arbitrary but unique process identifier > 0.       
370 * @param name     Name of the process e.g. "Process X".
371 * @param parent   Previously declared parent process identifier or 0 if
372 *                 process has no parent.
373 *
374 * @return         1 on success, 0 if an error occurs.       
375 *
376 * \ingroup writer
377 */
378int OTF_Writer_writeDefProcess( OTF_Writer* writer, 
379                                uint32_t stream,
380                                uint32_t process, 
381                                const char* name, 
382                                uint32_t parent );
383
384
385/**
386 * Write a process group definition record.
387 *
388 * OTF supports groups of processes. Their main objective is to classify
389 * processes depending on arbitrary characteristics. Processes can reside
390 * in multiple groups. This record type is optional.
391 *
392 * @param writer         Pointer to an initialized OTF_Writer object. See
393 *                       also OTF_Writer_open().
394 * @param stream         Target stream identifier with
395 *                       0 < stream <= number of streams as defined in
396 *                       OTF_Writer_open().
397 * @param procGroup      Arbitrary but unique process group identifier > 0.
398 * @param name           Name of the process group e.g. "Well Balanced".
399 * @param numberOfProcs  The number of processes in the process group.
400 * @param procs          Vector of process identifiers or previously defined
401 *                       process group identifiers as defined with
402 *                       OTF_Writer_writeDefProcess() resp.
403 *                       OTF_Writer_writeDefProcessGroup.
404 *
405 * @return               1 on success, 0 if an error occurs.       
406 *
407 * \ingroup writer
408 */
409int OTF_Writer_writeDefProcessGroup( OTF_Writer* writer, 
410                                     uint32_t stream,
411                                     uint32_t procGroup, 
412                                     const char* name, 
413                                     uint32_t numberOfProcs, 
414                                     const uint32_t* procs );
415
416
417/**
418 * Write a function definition record.
419 *
420 * Defines a function of the given name. Functions can optionally belong to a
421 * certain function group to be defined with the
422 * OTF_Writer_writeDefFunctionGroup() call. A source code reference can
423 * be added to the definition aswell.
424 *
425 * @param writer     Pointer to an initialized OTF_Writer object. See
426 *                   also OTF_Writer_open().
427 * @param stream     Target stream identifier with
428 *                   0 < stream <= number of streams as defined in
429 *                   OTF_Writer_open().
430 * @param func       Arbitrary but unique function identifier > 0.
431 * @param name       Name of the function e.g. "DoSomething".
432 * @param funcGroup  A function group identifier preliminary defined with
433 *                   OTF_Writer_writeDefFunctionGroup() or 0 for no
434 *                   function group assignment.       
435 * @param source     Reference to the function's source code location
436 *                   preliminary defined with OTF_Writer_writeDefScl() or
437 *                   0 for no source code location assignment.
438 *
439 * @return           1 on success, 0 if an error occurs.       
440 *
441 * \ingroup writer
442 */
443int OTF_Writer_writeDefFunction( OTF_Writer* writer, 
444                                 uint32_t stream,
445                                 uint32_t func, 
446                                 const char* name, 
447                                 uint32_t funcGroup, 
448                                 uint32_t source );
449
450
451/**
452 * Write a function group definition record.
453 *
454 * @param writer     Pointer to an initialized OTF_Writer object. See
455 *                   also OTF_Writer_open().
456 * @param stream     Target stream identifier with
457 *                   0 < stream <= number of streams as defined in
458 *                   OTF_Writer_open().
459 * @param funcGroup  An arbitrary but unique function group identifier > 0.
460 * @param name       Name of the function group e.g. "Computation".
461 *
462 * @return           1 on success, 0 if an error occurs.       
463 *
464 * \ingroup writer
465 */
466int OTF_Writer_writeDefFunctionGroup( OTF_Writer* writer, 
467                                      uint32_t stream,
468                                      uint32_t funcGroup, 
469                                      const char* name );
470
471
472/**
473 * Write a collective operation definition record.
474 *
475 * @param writer      Initialized OTF_Writer instance.
476 * @param stream      Target stream identifier with
477 *                    0 < stream <= number of streams as defined in
478 *                    OTF_Writer_open().
479 * @param collOp      An arbitrary but unique collective op. identifier > 0.
480 * @param name        Name of the collective operation e.g. "MPI_Bcast".
481 * @param type        One of the five supported collective classes:
482 *                    OTF_COLLECTIVE_TYPE_UNKNOWN (default),
483 *                    OTF_COLLECTIVE_TYPE_BARRIER,
484 *                    OTF_COLLECTIVE_TYPE_ONE2ALL,
485 *                    OTF_COLLECTIVE_TYPE_ALL2ONE,
486 *                    OTF_COLLECTIVE_TYPE_ALL2ALL.
487 *
488 * @return            1 on success, 0 if an error occurs.       
489 *
490 * \ingroup writer
491 */
492int OTF_Writer_writeDefCollectiveOperation( OTF_Writer* writer, 
493                                            uint32_t stream,
494                                            uint32_t collOp,
495                                            const char* name,
496                                            uint32_t type );
497
498
499/**
500 * Write a counter definition record.
501 *
502 * @param writer        Initialized OTF_Writer instance.
503 * @param stream        Target stream identifier with
504 *                      0 < stream <= number of streams as defined in
505 *                      OTF_Writer_open().
506 * @param counter       An arbitrary but unique counter identifier.
507 * @param name          Name of the counter e.g. "Cache Misses".
508 * @param properties    A combination of a type and scope counter property.
509 *                      OTF_COUNTER_TYPE_ACC (default) represents a counter
510 *                      with monotonously increasing values e.g. a FLOP
511 *                      counter. OTF_COUNTER_TYPE_ABS on the other hand
512 *                      defines a counter with alternating absolute values e.g.
513 *                      the memory usage of a process. The following counter
514 *                      measurement scopes are supported:
515 *                      OTF_COUNTER_SCOPE_START (default) always refers to the
516 *                      start of the process, OTF_COUNTER_SCOPE_POINT refers
517 *                      to exactly this moment in time, OTF_COUNTER_SCOPE_LAST
518 *                      relates to the previous measurement, and
519 *                      OTF_COUNTER_SCOPE_NEXT to the next measurement.
520 *                      Examples: OTF_COUNTER_TYPE_ACC +
521 *                      OTF_COUNTER_SCOPE_START should be used for most
522 *                      standard hardware (PAPI) counters.
523 *                      OTF_COUNTER_TYPE_ABS + OTF_COUNTER_SCOPE_POINT could
524 *                      be used to record information 'spikes'.
525 *                      OTF_COUNTER_TYPE_ABS + OTF_COUNTER_SCOPE_NEXT works
526 *                      for memory allocation recording.
527 * @param counterGroup  A previously defined counter group identifier or 0
528 *                      for no group.
529 * @param unit          Unit of the counter e.g. "#" for "number of..." or 0
530 *                      for no unit.
531 *
532 * @return              1 on success, 0 if an error occurs.       
533 *
534 * \ingroup writer
535 */
536int OTF_Writer_writeDefCounter( OTF_Writer* writer,
537                                uint32_t stream,
538                                uint32_t counter,
539                                const char* name,
540                                uint32_t properties, 
541                                uint32_t counterGroup, 
542                                const char* unit );
543
544
545/**
546 * Write a counter group definition record.
547 *
548 * @param writer       Initialized OTF_Writer instance.
549 * @param stream       Target stream identifier with
550 *                     0 < stream <= number of streams as defined in
551 *                     OTF_Writer_open().
552 * @param counterGroup An arbitrary but unique counter group identifier.
553 * @param name         Counter group name.
554 *
555 * @return             1 on success, 0 if an error occurs.       
556 *
557 * \ingroup writer
558 */
559int OTF_Writer_writeDefCounterGroup( OTF_Writer* writer, 
560                                     uint32_t stream,
561                                     uint32_t counterGroup, 
562                                     const char* name );
563
564
565/**
566 * Write a source code location (SCL) record.
567 *
568 * @param writer       Initialized OTF_Writer instance.
569 * @param stream       Target stream identifier with
570 *                     0 < stream <= number of streams as defined in
571 *                     OTF_Writer_open().
572 * @param source       Arbitrary but unique source code location
573 *                     identifier > 0.
574 * @param sourceFile   Previously defined source file identifier. See
575 *                     OTF_Writer_writeDefSclFile().
576 * @param line         Line number.
577 *
578 * @return             1 on success, 0 if an error occurs.       
579 *
580 * \ingroup writer
581 */
582int OTF_Writer_writeDefScl( OTF_Writer* writer,
583                            uint32_t stream,
584                            uint32_t source,
585                            uint32_t sourceFile, 
586                            uint32_t line );
587
588
589/**
590 * Write a source code location (SCL) file record.
591 *
592 * @param writer       Initialized OTF_Writer instance.
593 * @param stream       Target stream identifier with
594 *                     0 < stream <= number of streams as defined in
595 *                     OTF_Writer_open().
596 * @param sourceFile   Arbitrary but unique source code location
597 *                     identifier != 0.
598 * @param name         File name.
599 *
600 * @return             1 on success, 0 if an error occurs.       
601 *
602 * \ingroup writer
603 */
604int OTF_Writer_writeDefSclFile( OTF_Writer* writer,
605                                uint32_t stream, 
606                                uint32_t sourceFile,
607                                const char* name );
608
609
610/**
611 * depricated. The Otf-Version-record is generated automatically at beginning of
612 * tracing in the global definiton stream.
613 *
614 * \ingroup writer
615 */
616int OTF_Writer_writeOtfVersion( OTF_Writer* writer, uint32_t stream );
617
618
619/**
620 * Write a creator record.
621 *
622 * @param writer       Initialized OTF_Writer instance.
623 * @param stream       Target stream identifier with
624 *                     0 < stream <= number of streams as defined in
625 *                     OTF_Writer_open().
626 * @param creator      String which identifies the creator of the
627 *                     file e.g. "TAU Version x.y.z".
628 *
629 * @return             1 on success, 0 if an error occurs.       
630 *
631 * \ingroup writer
632 */
633int OTF_Writer_writeDefCreator( OTF_Writer* writer, uint32_t stream,
634                                const char* creator );
635
636
637
638
639/**
640 * Write a file definition record
641 *
642 * @param writer       Initialized OTF_Writer instance.
643 * @param stream       Target stream identifier with
644 *                     0 < stream <= number of streams as defined in
645 *                     OTF_Writer_open().
646 * @param token        Arbitrary, unique identifier for the file.
647 *                     Has to be > 0.
648 * @param name         Name of the file.
649 * @param group        File group identifier or 0 for no group.
650 *
651 * @return             1 on success, 0 if an error occurs.       
652 *
653 * \ingroup writer
654 */
655int OTF_Writer_writeDefFile( OTF_Writer* writer,
656                             uint32_t stream,
657                             uint32_t token,
658                             const char* name,
659                             uint32_t group );
660
661
662/**
663 * Write a file group definition record
664 *
665 * @param writer       Initialized OTF_Writer instance.
666 * @param stream       Target stream identifier with
667 *                     0 < stream <= number of streams as defined in
668 *                     OTF_Writer_open().
669 * @param token        Arbitrary, unique identifier for the file group.
670 *                     Has to be > 0.
671 * @param name         Name of the file group.
672 *
673 * @return             1 on success, 0 if an error occurs.       
674 *
675 * \ingroup writer
676 */
677int OTF_Writer_writeDefFileGroup( OTF_Writer* writer,
678                                  uint32_t stream,
679                                  uint32_t token,
680                                  const char* name );
681
682
683/**
684 * Write a function entry record.
685 *
686 * @param writer    Initialized OTF_Writer instance.
687 * @param time      The time when the function entry took place.
688 * @param function  Function to be entered as defined with
689 *                  OTF_Writer_defFunction.
690 * @param process   Process where action took place.
691 * @param source    Optional reference to source code.
692 *
693 * @return          1 on success, 0 if an error occurs.       
694 *
695 * \ingroup writer
696 */
697int OTF_Writer_writeEnter( OTF_Writer* writer, 
698                           uint64_t time, 
699                           uint32_t function, 
700                           uint32_t process, 
701                           uint32_t source );
702
703
704/**
705 * Write a function leave record.
706 *
707 * @param writer    Initialized OTF_Writer instance.
708 * @param time      The time when the function leave took place.
709 * @param function  Function which was left or 0 if stack integrety checking
710 *                  is not needed.
711 * @param process   Process where action took place.
712 * @param source    Explicit source code location or 0.
713 *
714 * @return          1 on success, 0 if an error occurs.       
715 *
716 * \ingroup writer
717 */
718int OTF_Writer_writeLeave( OTF_Writer* writer, 
719                           uint64_t time, 
720                           uint32_t function, 
721                           uint32_t process, 
722                           uint32_t source );
723
724
725/**
726 * Write a message retrieval record.
727 *
728 * @param writer    Initialized OTF_Writer instance.
729 * @param time      The time when the message was received.
730 * @param receiver  Identifier of receiving process.
731 * @param sender    Identifier of sending process.
732 * @param procGroup Optional process-group sender and receiver belong to,
733 *                  '0' for no group.
734 * @param tag       Optional message type information.
735 * @param length    Optional message length information.
736 * @param source    Optional reference to source code.
737 *
738 * @return          1 on success, 0 if an error occurs.       
739 *
740 * \ingroup writer
741 */
742int OTF_Writer_writeRecvMsg( OTF_Writer* writer, 
743                             uint64_t time, 
744                             uint32_t receiver, 
745                             uint32_t sender, 
746                             uint32_t procGroup, 
747                             uint32_t tag, 
748                             uint32_t length, 
749                             uint32_t source );
750
751
752/**
753 * Write a message send record.
754 *
755 * @param writer    Initialized OTF_Writer instance.
756 * @param time      The time when the message was send.
757 * @param sender    Sender of the message.
758 * @param receiver  Receiver of the message.
759 * @param procGroup Optional process-group sender and receiver belong to,
760 *                  '0' for no group.
761 * @param tag       Optional message type information.
762 * @param length    Optional message length information.
763 * @param source    Optional reference to source code.
764 *
765 * @return          1 on success, 0 if an error occurs.       
766 *
767 * \ingroup writer
768 */
769int OTF_Writer_writeSendMsg( OTF_Writer* writer, 
770                             uint64_t time, 
771                             uint32_t sender, 
772                             uint32_t receiver, 
773                             uint32_t procGroup, 
774                             uint32_t tag, 
775                             uint32_t length, 
776                             uint32_t source );
777
778
779/**
780 * Write a counter measurement record.
781 *
782 * @param writer    Initialized OTF_Writer instance.
783 * @param time      Time when counter was measured.
784 * @param process   Process where counter measurment took place.
785 * @param counter   Counter which was measured.
786 * @param value     Counter value.
787 *
788 * @return          1 on success, 0 if an error occurs.       
789 *
790 * \ingroup writer
791 */
792int OTF_Writer_writeCounter( OTF_Writer* writer, 
793                             uint64_t time, 
794                             uint32_t process, 
795                             uint32_t counter, 
796                             uint64_t value );
797
798
799/**
800 * Write a collective operation member record.
801 *
802 * @param writer      Initialized OTF_Writer instance.
803 * @param time        Time when collective operation was entered by member.
804 * @param process     Process identifier i.e. collective member.
805 * @param collective  Collective identifier to be defined with
806 *                    OTF_Writer_writeDefCollectiveOperation().
807 * @param procGroup   Group of processes participating in this collective.
808 * @param rootProc    Root process if != 0.
809 * @param sent        Data volume sent by member or 0.
810 * @param received    Data volumd received by member or 0.
811 * @param duration    Time spent in collective operation.
812 * @param source      Explicit source code location or 0.
813 *
814 * @return            1 on success, 0 if an error occurs.       
815 *
816 * \ingroup writer
817 */
818int OTF_Writer_writeCollectiveOperation( OTF_Writer* writer, 
819                                         uint64_t time, 
820                                         uint32_t process, 
821                                         uint32_t collective, 
822                                         uint32_t procGroup, 
823                                         uint32_t rootProc, 
824                                         uint32_t sent, 
825                                         uint32_t received, 
826                                         uint64_t duration, 
827                                         uint32_t source );
828
829
830/**
831 * Write a comment record.
832 *
833 * @param writer    Initialized OTF_Writer instance.
834 * @param time      Comments need a timestamp for a proper positioning in the
835 *                  trace.
836 * @param process   Comments also need a process identifier for a proper
837 *                  positioning in the trace.
838 * @param comment   Arbitrary comment string.
839 *
840 * @return          1 on success, 0 if an error occurs.       
841 *
842 * \ingroup writer
843 */
844 
845int OTF_Writer_writeEventComment( OTF_Writer* writer, 
846                                  uint64_t time, 
847                                  uint32_t process, 
848                                  const char* comment );
849
850
851/**
852 * Write a begin process record
853 *
854 * @param writer    Initialized OTF_Writer instance.
855 * @param time      Time when process was referenced for the first time.
856 * @param process   Process identifier > 0.
857 *
858 * @return          1 on success, 0 if an error occurs.       
859 *
860 * \ingroup writer
861 */
862 
863int OTF_Writer_writeBeginProcess( OTF_Writer* writer,
864                                  uint64_t time,
865                                  uint32_t process );
866
867
868/**
869 * Write a end process record
870 *
871 * @param writer    Initialized OTF_Writer instance.
872 * @param time      Time when process was referenced for the last time.
873 * @param process   Process identifier > 0.
874 *
875 * @return          1 on success, 0 if an error occurs.       
876 *
877 * \ingroup writer
878 */
879 
880int OTF_Writer_writeEndProcess( OTF_Writer* writer,
881                                uint64_t time,
882                                uint32_t process );
883
884
885/**
886 * Write an file operation record
887 *
888 * @param writer    Initialized OTF_Writer instance.
889 *
890 * @param time      Time when process was referenced for the last time.
891 *
892 * @param fileid    File identifier > 0.
893 *
894 * @param handleid  File open identifier.
895 *
896 * @param process   Process identifier > 0.
897 *
898 * @param operation Type of file operation @see OTF_Handler_FileOperation()
899 *
900 * @param bytes     Depends on operation @see OTF_Handler_FileOperation()
901 * @param duration  time spent in the file operation
902 *
903 * @return          1 on success, 0 if an error occurs.       
904 *
905 * \ingroup writer
906 */
907int OTF_Writer_writeFileOperation( OTF_Writer* writer,
908                                   uint64_t time,
909                                   uint32_t fileid,
910                                   uint32_t process,
911                                   uint64_t handleid,
912                                   uint32_t operation,
913                                   uint64_t bytes,
914                                   uint64_t duration,
915                                   uint32_t source );
916
917/* *** public snapshot record write handlers *** */
918
919/**
920 * Write a snapshot comment record.
921 *
922 * @param writer    Initialized OTF_Writer instance.
923 * @param time      Comments need a timestamp for a proper positioning in the
924 *                  trace.
925 * @param process   Comments also need a process identifier for a proper
926 *                  positioning in the trace.
927 * @param comment   Arbitrary comment string.
928 *
929 * @return          1 on success, 0 if an error occurs.       
930 *
931 * \ingroup writer
932 */
933 
934int OTF_Writer_writeSnapshotComment( OTF_Writer* writer, 
935                                  uint64_t time, 
936                                  uint32_t process, 
937                                  const char* comment );
938
939
940/**
941 * Write an enter snapshot which provides information about a past
942 * function call
943 *
944 * @param writer        Initialized OTF_Writer instance.
945 * @param time          Time when the snapshot was written(current time).
946 * @param originaltime  Time when the according enter record was entered.
947 *                      This call is still on the stack.(It has not been left
948 *                      yet)
949 * @param function      Function that the has been entered
950 *                      OTF_Writer_defFunction.
951 * @param process       Process where action took place.
952 * @param source        Optional reference to source code.
953 *
954 * @return              1 on success, 0 if an error occurs.       
955 *
956 * \ingroup writer
957 */
958int OTF_Writer_writeEnterSnapshot( OTF_Writer* writer, 
959                           uint64_t time, 
960                           uint64_t originaltime, 
961                           uint32_t function, 
962                           uint32_t process, 
963                           uint32_t source );
964
965/**
966 * Write a send snapshot which provides information about a past
967 * message send operation that is still pending, i.e. not yet received
968 *
969 * @param writer        Initialized OTF_Writer instance.
970 * @param time          Time when the snapshot was written(current time).
971 * @param originaltime  Time when the message was sent
972 * @param sender        Sender of the message.
973 * @param receiver      Receiver of the message.
974 * @param procGroup     Optional process-group sender and receiver belong to,
975 *                      '0' for no group.
976 * @param tag           Optional message type information.
977 * @param source        Optional reference to source code.
978 *
979 * @return              1 on success, 0 if an error occurs.       
980 *
981 * \ingroup writer
982 */
983int OTF_Writer_writeSendSnapshot( OTF_Writer* writer,
984                                  uint64_t time,
985                                  uint64_t originaltime,
986                                  uint32_t sender,
987                                  uint32_t receiver,
988                                  uint32_t procGroup,
989                                  uint32_t tag,
990                                  uint32_t source );
991
992
993/**
994 * Write a snapshot record for an open (and not yet closed) file
995 *
996 * @param writer        Initialized OTF_Writer instance.
997 * @param time          Time when the snapshot was written(current time).
998 * @param originaltime  Time when the message was sent.
999 * @param fileid        File identifier.
1000 * @param process       Process where the file was opened.
1001 * @param handleid      Unique file open identifier. @see OTF_Handler_FileOperation()
1002 * @param source        Optional reference to source code.
1003 *
1004 * @return              1 on success, 0 if an error occurs.       
1005 *
1006 * \ingroup writer
1007 */
1008int OTF_Writer_writeOpenFileSnapshot( OTF_Writer* writer,
1009                                      uint64_t time,
1010                                      uint64_t originaltime,
1011                                      uint32_t fileid,
1012                                      uint32_t process,
1013                                      uint64_t handleid,
1014                                      uint32_t source );
1015
1016
1017                           
1018/* *** public statistics record write handlers *** */
1019
1020
1021/**
1022 * Write a summary comment record.
1023 *
1024 * @param writer    Initialized OTF_Writer instance.
1025 * @param time      Comments need a timestamp for a proper positioning in the
1026 *                  trace.
1027 * @param process   Comments also need a process identifier for a proper
1028 *                  positioning in the trace.
1029 * @param comment   Arbitrary comment string.
1030 *
1031 * @return          1 on success, 0 if an error occurs.       
1032 *
1033 * \ingroup writer
1034 */
1035 
1036int OTF_Writer_writeSummaryComment( OTF_Writer* writer, 
1037                                  uint64_t time, 
1038                                  uint32_t process, 
1039                                  const char* comment );
1040
1041
1042/**
1043 * Write a function summary record.
1044 *
1045 * @param writer       Initialized OTF_Writer instance.
1046 * @param time         Time when summary was computed.
1047 * @param function     Function as defined with
1048 *                     OTF_Handler_DefFunction.
1049 * @param process      Process of the given function.
1050 * @param count        Number of invocations.
1051 * @param excltime     Time spent exclusively in the given function.
1052 * @param incltime     Time spent in the given function including all
1053 *                     sub-routine calls.
1054 *
1055 * @return             1 on success, 0 if an error occurs.       
1056 *
1057 * \ingroup writer
1058 */
1059
1060int OTF_Writer_writeFunctionSummary( OTF_Writer* writer, 
1061        uint64_t time, uint32_t function, uint32_t process, 
1062        uint64_t count, uint64_t excltime, uint64_t incltime );
1063
1064/**
1065 * Write a functiongroup summary record.
1066 *
1067 * @param writer         Initialized OTF_Writer instance.
1068 * @param time           Time when summary was computed.
1069 * @param functiongroup  Function group as defined with
1070 *                       OTF_Handler_DefFunctionGroup.
1071 * @param process        Process of the given function group.
1072 * @param count          Number of invocations.
1073 * @param excltime       Time spent exclusively in the given function group.
1074 * @param incltime       Time spent in the given function group including all
1075 *                       sub-routine calls.
1076 *
1077 * @return               1 on success, 0 if an error occurs.       
1078 *
1079 * \ingroup writer
1080 */
1081
1082int OTF_Writer_writeFunctionGroupSummary( OTF_Writer* writer, 
1083        uint64_t time,  uint32_t functiongroup,  uint32_t process, 
1084        uint64_t count,  uint64_t excltime,  uint64_t incltime );
1085
1086/**
1087 * Write a message summary record.
1088 *
1089 * @param writer         Initialized OTF_Writer instance.
1090 * @param time           Time when summary was computed.
1091 * @param process        Process where messages originated.
1092 * @param peer           Process where the message is sent to
1093 * @param comm           Communicator of message summary
1094 * @param tag            Message type/tag.
1095 * @param number_sent    The number of messages sent.
1096 * @param number_recved  The number of messages received.
1097 * @param bytes_sent     The number of bytes sent via messages of the given
1098 *                       type.
1099 * @param bytes_recved   The number of bytes received through messages of the
1100 *                       given type.
1101 *
1102 * @return               1 on success, 0 if an error occurs.       
1103 *
1104 * \ingroup writer
1105 */
1106
1107int OTF_Writer_writeMessageSummary( OTF_Writer* writer, 
1108        uint64_t time, uint32_t process, uint32_t peer,
1109        uint32_t comm, uint32_t tag,  uint64_t number_sent,
1110        uint64_t number_recved, uint64_t bytes_sent, uint64_t bytes_recved );
1111
1112
1113/**
1114 * Writes a file operation summary record.
1115 *
1116 * @param writer         Initialized OTF_Writer instance.
1117 * @param time           Time when summary was computed.
1118 * @param fileid         File identifier or 0 for all  files.
1119 * @param process        Process where file operations occured.
1120 * @param nopen          Number of files opened.
1121 * @param nclose         Number of files closed.
1122 * @param nread          Number of read events.
1123 * @param nwrite         Number of write events.
1124 * @param nseek          Number of seek events.
1125 * @param bytesread      Number of bytes read.
1126 * @param byteswrite     Number of bytes written.
1127 *
1128 * @return               1 on success, 0 if an error occurs.       
1129 *
1130 * \ingroup writer
1131 */
1132int OTF_Writer_writeFileOperationSummary( OTF_Writer* writer, uint64_t time,
1133        uint32_t fileid, uint32_t process, uint64_t nopen, uint64_t nclose,
1134        uint64_t nread, uint64_t nwrite, uint64_t nseek, uint64_t bytesread,
1135        uint64_t byteswrite );
1136
1137
1138/**
1139 * Writes a file group operation summary record.
1140 *
1141 * @param writer         Initialized OTF_Writer instance.
1142 * @param time           Time when summary was computed.
1143 * @param groupid        File group identifier or 0 for all  files/groups.
1144 * @param process        Process where file operations occured.
1145 * @param nopen          Number of files opened.
1146 * @param nclose         Number of files closed.
1147 * @param nread          Number of read events.
1148 * @param nwrite         Number of write events.
1149 * @param nseek          Number of seek events.
1150 * @param bytesread      Number of bytes read.
1151 * @param byteswrite     Number of bytes written.
1152 *
1153 * @return               1 on success, 0 if an error occurs.       
1154 *
1155 * \ingroup writer
1156 */
1157int OTF_Writer_writeFileGroupOperationSummary( OTF_Writer* writer, uint64_t time,
1158        uint32_t groupid, uint32_t process, uint64_t nopen, uint64_t nclose,
1159        uint64_t nread, uint64_t nwrite, uint64_t nseek, uint64_t bytesread,
1160        uint64_t byteswrite );
1161/* *** private member functions *** */
1162
1163
1164/** For a process with id 'processId' return a stream id of the stream the
1165    data is to be written to. If no mapping has been set so far it is defined
1166    in a way such that it is added to the stream with the least processes.
1167        \ingroup writer */
1168uint32_t OTF_Writer_mapProcess( OTF_Writer* writer, uint32_t processId );
1169
1170
1171/** Return the stream with the given stream id. If there is no such stream yet
1172    create one and append it to 'streams'. \ingroup writer */
1173OTF_WStream* OTF_Writer_getStream( OTF_Writer* writer, uint32_t stream );
1174
1175#ifdef __cplusplus
1176}
1177#endif /* __cplusplus */
1178
1179#endif /* OTF_WRITER_H */
1180
Note: See TracBrowser for help on using the repository browser.