OpenMPI 0.1.1

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

vt_unify_defs_recs.h
1 /**
2 * VampirTrace
3 * http://www.tu-dresden.de/zih/vampirtrace
4 *
5 * Copyright (c) 2005-2012, ZIH, TU Dresden, Federal Republic of Germany
6 *
7 * Copyright (c) 1998-2005, Forschungszentrum Juelich, Juelich Supercomputing
8 * Centre, Federal Republic of Germany
9 *
10 * See the file COPYING in the package base directory for details
11 **/
12
13 #ifndef _VT_UNIFY_DEFS_RECS_H_
14 #define _VT_UNIFY_DEFS_RECS_H_
15
16 #include "config.h"
17
18 #include "vt_unify.h"
19
20 #include "vt_inttypes.h"
21
22 #include "util/hash.h"
23
24 #include "otf.h"
25
26 #include <algorithm>
27 #include <set>
28 #include <string>
29 #include <vector>
30
31 #include <string.h>
32
33 //
34 // definition record types
35 //
36 typedef enum
37 {
38 DEF_REC_TYPE__DefCreator,
39 DEF_REC_TYPE__DefTimerResolution,
40 DEF_REC_TYPE__DefTimeRange,
41 DEF_REC_TYPE__DefProcess,
42 DEF_REC_TYPE__DefProcessGroup,
43 DEF_REC_TYPE__DefProcessGroupAttributes,
44 DEF_REC_TYPE__DefSclFile,
45 DEF_REC_TYPE__DefScl,
46 DEF_REC_TYPE__DefFileGroup,
47 DEF_REC_TYPE__DefFile,
48 DEF_REC_TYPE__DefFunctionGroup,
49 DEF_REC_TYPE__DefFunction,
50 DEF_REC_TYPE__DefCollOp,
51 DEF_REC_TYPE__DefCounterGroup,
52 DEF_REC_TYPE__DefCounter,
53 DEF_REC_TYPE__DefCounterAssignments,
54 DEF_REC_TYPE__DefKeyValue,
55 DEF_REC_TYPE__DefMarker,
56 DEF_REC_TYPE__DefComment,
57 DEF_REC_TYPE__Num
58 } DefRecTypeT;
59
60 //
61 // DefRec_BaseS
62 //
63 struct DefRec_BaseS
64 {
65 //
66 // compare structure for final sort
67 //
68 struct SortS
69 {
70 bool operator()( const DefRec_BaseS * a, const DefRec_BaseS * b ) const
71 {
72 return a->deftoken < b->deftoken;
73 }
74
75 };
76
77 DefRec_BaseS( DefRecTypeT _dtype )
78 : dtype( _dtype ), loccpuid( 0 ), deftoken( 0 ) {}
79 DefRec_BaseS( const DefRecTypeT & _dtype, const uint32_t & _loccpuid,
80 const uint32_t & _deftoken )
81 : dtype( _dtype ), loccpuid( _loccpuid ), deftoken( _deftoken ) {}
82 virtual ~DefRec_BaseS() {}
83
84 #ifdef VT_MPI
85 virtual VT_MPI_INT getPackSize();
86 virtual void pack( char *& buffer, const VT_MPI_INT & bufferSize,
87 VT_MPI_INT & bufferPos );
88 virtual void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
89 VT_MPI_INT & bufferPos );
90 #endif // VT_MPI
91
92 // NOTE: this operator is actually not used but necessary to work around
93 // a build error with the Clang++ compiler
94 // (see http://www.open-mpi.org/community/lists/devel/2012/02/10419.php)
95 bool operator<( const DefRec_BaseS & a ) const
96 {
97 return dtype < a.dtype;
98 }
99
100 DefRecTypeT dtype;
101 uint32_t loccpuid;
102 uint32_t deftoken;
103
104 };
105
106 //
107 // DefRec_DefCommentS
108 //
109 struct DefRec_DefCommentS : DefRec_BaseS
110 {
111 //
112 // compare structure for final sort
113 //
114 struct SortS
115 {
116 bool operator()( const DefRec_DefCommentS * a,
117 const DefRec_DefCommentS * b ) const
118 {
119 if( a->type == b->type )
120 return a->deftoken < b->deftoken; // order index
121 else
122 return a->type < b->type;
123 }
124
125 };
126
127 typedef enum
128 {
129 TYPE_START_TIME, TYPE_STOP_TIME, TYPE_VT, TYPE_USER,
130 TYPE_USRCOM_SEND, TYPE_USRCOM_RECV, TYPE_UNKNOWN
131 } CommentTypeT;
132
133 DefRec_DefCommentS()
134 : DefRec_BaseS( DEF_REC_TYPE__DefComment ), type( TYPE_UNKNOWN ) {}
135 DefRec_DefCommentS( const uint32_t & _loccpuid, const uint32_t _orderidx,
136 const CommentTypeT & _type, const std::string & _comment )
137 : DefRec_BaseS( DEF_REC_TYPE__DefComment, _loccpuid, _orderidx ),
138 type( _type ), comment( _comment ) {}
139
140 #ifdef VT_MPI
141 VT_MPI_INT getPackSize();
142 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
143 VT_MPI_INT & bufferPos );
144 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
145 VT_MPI_INT & bufferPos );
146 #endif // VT_MPI
147
148 // operator for searching
149 bool operator<( const DefRec_DefCommentS & a ) const
150 {
151 if( type == a.type )
152 return comment < a.comment;
153 else
154 return type < a.type;
155 }
156
157 CommentTypeT type;
158 std::string comment;
159
160 };
161
162 //
163 // DefRec_DefCreatorS
164 //
165 struct DefRec_DefCreatorS : DefRec_BaseS
166 {
167 DefRec_DefCreatorS()
168 : DefRec_BaseS( DEF_REC_TYPE__DefCreator ) {}
169 DefRec_DefCreatorS( const std::string & _creator )
170 : DefRec_BaseS( DEF_REC_TYPE__DefCreator ),
171 creator( _creator ) {}
172
173 #ifdef VT_MPI
174 VT_MPI_INT getPackSize();
175 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
176 VT_MPI_INT & bufferPos );
177 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
178 VT_MPI_INT & bufferPos );
179 #endif // VT_MPI
180
181 std::string creator;
182
183 };
184
185 //
186 // DefRec_DefTimerResolutionS
187 //
188 struct DefRec_DefTimerResolutionS : DefRec_BaseS
189 {
190 DefRec_DefTimerResolutionS()
191 : DefRec_BaseS( DEF_REC_TYPE__DefTimerResolution ),
192 ticksPerSecond( 0 ) {}
193 DefRec_DefTimerResolutionS( const uint64_t & _ticksPerSecond )
194 : DefRec_BaseS( DEF_REC_TYPE__DefTimerResolution ),
195 ticksPerSecond( _ticksPerSecond ) {}
196
197 #ifdef VT_MPI
198 VT_MPI_INT getPackSize();
199 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
200 VT_MPI_INT & bufferPos );
201 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
202 VT_MPI_INT & bufferPos );
203 #endif // VT_MPI
204
205 uint64_t ticksPerSecond;
206
207 };
208
209 //
210 // DefRec_DefTimeRangeS
211 //
212 struct DefRec_DefTimeRangeS : DefRec_BaseS
213 {
214 DefRec_DefTimeRangeS()
215 : DefRec_BaseS( DEF_REC_TYPE__DefTimeRange ),
216 minTime( 0 ), maxTime( 0 ) {}
217 DefRec_DefTimeRangeS( const uint32_t & _loccpuid, const uint64_t & _minTime,
218 const uint64_t & _maxTime )
219 : DefRec_BaseS( DEF_REC_TYPE__DefTimeRange, _loccpuid, 0 ),
220 minTime( _minTime ), maxTime( _maxTime ) {}
221
222 #ifdef VT_MPI
223 VT_MPI_INT getPackSize();
224 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
225 VT_MPI_INT & bufferPos );
226 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
227 VT_MPI_INT & bufferPos );
228 #endif // VT_MPI
229
230 uint64_t minTime;
231 uint64_t maxTime;
232
233 };
234
235 //
236 // DefRec_DefProcessS
237 //
238 struct DefRec_DefProcessS : DefRec_BaseS
239 {
240 //
241 // compare structure for final sort
242 //
243 struct SortS
244 {
245 bool operator()( const DefRec_DefProcessS * a,
246 const DefRec_DefProcessS * b ) const
247 {
248 if( ( a->deftoken & VT_TRACEID_BITMASK ) ==
249 ( b->deftoken & VT_TRACEID_BITMASK ) )
250 return a->deftoken < b->deftoken;
251 else
252 return ( a->deftoken & VT_TRACEID_BITMASK ) <
253 ( b->deftoken & VT_TRACEID_BITMASK );
254 }
255
256 };
257
258 DefRec_DefProcessS()
259 : DefRec_BaseS( DEF_REC_TYPE__DefProcess ),
260 parent( 0 ) {}
261 DefRec_DefProcessS( const uint32_t & _deftoken, const std::string & _name,
262 const uint32_t & _parent )
263 : DefRec_BaseS( DEF_REC_TYPE__DefProcess, 0, _deftoken ),
264 name( _name ), parent( _parent ) {}
265
266 #ifdef VT_MPI
267 VT_MPI_INT getPackSize();
268 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
269 VT_MPI_INT & bufferPos );
270 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
271 VT_MPI_INT & bufferPos );
272 #endif // VT_MPI
273
274 // operator for searching
275 bool operator<( const DefRec_DefProcessS & a ) const
276 {
277 if( parent == a.parent )
278 return name < a.name;
279 else
280 return parent < a.parent;
281 }
282
283 std::string name;
284 uint32_t parent;
285
286 };
287
288 //
289 // DefRec_DefProcessGroupS
290 //
291 struct DefRec_DefProcessGroupS : DefRec_BaseS
292 {
293 typedef enum
294 {
295 TYPE_ALL, TYPE_NODE, TYPE_MPI_COMM_WORLD, TYPE_MPI_COMM_SELF,
296 TYPE_MPI_COMM_OTHER, TYPE_MPI_GROUP, TYPE_USER_COMM, TYPE_OTHER,
297 TYPE_UNKNOWN
298 } ProcessGroupTypeT;
299
300 DefRec_DefProcessGroupS()
301 : DefRec_BaseS( DEF_REC_TYPE__DefProcessGroup ), type( TYPE_UNKNOWN ),
302 members_hash( 0 ), nmembers( 0 ), members( 0 ) {}
303 DefRec_DefProcessGroupS( const uint32_t & _loccpuid,
304 const uint32_t & _deftoken, const ProcessGroupTypeT & _type,
305 const std::string & _name, const uint32_t & _nmembers,
306 const uint32_t * _members )
307 : DefRec_BaseS( DEF_REC_TYPE__DefProcessGroup, _loccpuid, _deftoken ),
308 type( _type ), name( _name ), members_hash( 0 ), nmembers( 0 ),
309 members( 0 )
310 {
311 assignMembers( _nmembers, _members, _members + _nmembers );
312
313 if( nmembers > 0 &&
314 ( type == TYPE_MPI_COMM_WORLD || type == TYPE_MPI_COMM_OTHER ||
315 type == TYPE_MPI_GROUP ) )
316 {
317 members_hash =
318 vt_hash( (unsigned char*)members,
319 nmembers * sizeof( uint32_t ), 0 );
320 }
321 }
322 DefRec_DefProcessGroupS( const DefRec_DefProcessGroupS & a )
323 : DefRec_BaseS( DEF_REC_TYPE__DefProcessGroup, a.loccpuid, a.deftoken ),
324 type( a.type ), name( a.name ), members_hash( a.members_hash ),
325 nmembers( 0 ), members( 0 )
326 {
327 assignMembers( a.nmembers, a.members, a.members + a.nmembers );
328 }
329 ~DefRec_DefProcessGroupS()
330 {
331 if( nmembers > 0 )
332 delete [] members;
333 }
334
335 template <class InputIterator>
336 void assignMembers( uint32_t n, InputIterator first, InputIterator last )
337 {
338 if( nmembers > 0 )
339 delete [] members;
340
341 nmembers = n;
342 members = 0;
343 if( nmembers > 0 )
344 {
345 members = new uint32_t[nmembers];
346 assert( members );
347 std::copy( first, last, members );
348 }
349 }
350
351 #ifdef VT_MPI
352 VT_MPI_INT getPackSize();
353 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
354 VT_MPI_INT & bufferPos );
355 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
356 VT_MPI_INT & bufferPos );
357 #endif // VT_MPI
358
359 // operator for searching
360 bool operator<( const DefRec_DefProcessGroupS & a ) const
361 {
362 if( type == a.type )
363 {
364 if( nmembers == a.nmembers )
365 {
366 if( name == a.name )
367 {
368 return
369 memcmp( members, a.members,
370 nmembers * sizeof( uint32_t ) ) < 0;
371 }
372 else
373 {
374 return name < a.name;
375 }
376 }
377 else
378 {
379 return nmembers < a.nmembers;
380 }
381 }
382 else
383 {
384 return type < a.type;
385 }
386 }
387
388 ProcessGroupTypeT type;
389 std::string name;
390 uint32_t members_hash;
391 uint32_t nmembers;
392 uint32_t * members;
393
394 };
395
396 //
397 // DefRec_DefProcessGroupAttributesS
398 //
399 struct DefRec_DefProcessGroupAttributesS : DefRec_BaseS
400 {
401 DefRec_DefProcessGroupAttributesS()
402 : DefRec_BaseS( DEF_REC_TYPE__DefProcessGroupAttributes ),
403 attributes( 0 ) {}
404 DefRec_DefProcessGroupAttributesS( const uint32_t & _loccpuid,
405 const uint32_t & _deftoken, const uint32_t & _attributes )
406 : DefRec_BaseS( DEF_REC_TYPE__DefProcessGroupAttributes, _loccpuid,
407 _deftoken ), attributes( _attributes ) {}
408
409 #ifdef VT_MPI
410 VT_MPI_INT getPackSize();
411 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
412 VT_MPI_INT & bufferPos );
413 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
414 VT_MPI_INT & bufferPos );
415 #endif // VT_MPI
416
417 // operator for searching
418 bool operator<( const DefRec_DefProcessGroupAttributesS & a ) const
419 {
420 return attributes < a.attributes;
421 }
422
423 uint32_t attributes;
424
425 };
426
427 //
428 // DefRec_DefSclFileS
429 //
430 struct DefRec_DefSclFileS : DefRec_BaseS
431 {
432 DefRec_DefSclFileS()
433 : DefRec_BaseS( DEF_REC_TYPE__DefSclFile ) {}
434 DefRec_DefSclFileS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
435 std::string _filename)
436 : DefRec_BaseS( DEF_REC_TYPE__DefSclFile, _loccpuid, _deftoken ),
437 filename( _filename ) {}
438
439 #ifdef VT_MPI
440 VT_MPI_INT getPackSize();
441 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
442 VT_MPI_INT & bufferPos );
443 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
444 VT_MPI_INT & bufferPos );
445 #endif // VT_MPI
446
447 // operator for searching
448 bool operator<( const DefRec_DefSclFileS & a ) const
449 {
450 return filename < a.filename;
451 }
452
453 std::string filename;
454
455 };
456
457 //
458 // DefRec_DefSclS
459 //
460 struct DefRec_DefSclS : DefRec_BaseS
461 {
462 DefRec_DefSclS()
463 : DefRec_BaseS( DEF_REC_TYPE__DefScl ),
464 sclfile( 0 ), sclline( 0 ) {}
465 DefRec_DefSclS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
466 const uint32_t & _sclfile, const uint32_t & _sclline )
467 : DefRec_BaseS( DEF_REC_TYPE__DefScl, _loccpuid, _deftoken ),
468 sclfile( _sclfile ), sclline( _sclline ) {}
469
470 #ifdef VT_MPI
471 VT_MPI_INT getPackSize();
472 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
473 VT_MPI_INT & bufferPos );
474 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
475 VT_MPI_INT & bufferPos );
476 #endif // VT_MPI
477
478 // operator for searching
479 bool operator<( const DefRec_DefSclS & a ) const
480 {
481 if( sclfile == a.sclfile )
482 return sclline < a.sclline;
483 else
484 return sclfile < a.sclfile;
485 }
486
487 uint32_t sclfile;
488 uint32_t sclline;
489
490 };
491
492 //
493 // DefRec_DefFileGroupS
494 //
495 struct DefRec_DefFileGroupS : DefRec_BaseS
496 {
497 DefRec_DefFileGroupS()
498 : DefRec_BaseS( DEF_REC_TYPE__DefFileGroup ) {}
499 DefRec_DefFileGroupS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
500 const std::string & _name)
501 : DefRec_BaseS( DEF_REC_TYPE__DefFileGroup, _loccpuid, _deftoken ),
502 name( _name ) {}
503
504 #ifdef VT_MPI
505 VT_MPI_INT getPackSize();
506 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
507 VT_MPI_INT & bufferPos );
508 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
509 VT_MPI_INT & bufferPos );
510 #endif // VT_MPI
511
512 // operator for searching
513 bool operator<( const DefRec_DefFileGroupS & a ) const
514 {
515 return name < a.name;
516 }
517
518 std::string name;
519
520 };
521
522 //
523 // DefRec_DefFileS
524 //
525 struct DefRec_DefFileS : DefRec_BaseS
526 {
527 DefRec_DefFileS()
528 : DefRec_BaseS( DEF_REC_TYPE__DefFile ),
529 group( 0 ) {}
530 DefRec_DefFileS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
531 const std::string & _name, const uint32_t & _group )
532 : DefRec_BaseS( DEF_REC_TYPE__DefFile, _loccpuid, _deftoken ),
533 name( _name ), group( _group ) {}
534
535 #ifdef VT_MPI
536 VT_MPI_INT getPackSize();
537 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
538 VT_MPI_INT & bufferPos );
539 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
540 VT_MPI_INT & bufferPos );
541 #endif // VT_MPI
542
543 // operator for searching
544 bool operator<( const DefRec_DefFileS & a ) const
545 {
546 if( group == a.group )
547 return name < a.name;
548 else
549 return group < a.group;
550 }
551
552 std::string name;
553 uint32_t group;
554
555 };
556
557 //
558 // DefRec_DefFunctionGroupS
559 //
560 struct DefRec_DefFunctionGroupS : DefRec_BaseS
561 {
562 DefRec_DefFunctionGroupS()
563 : DefRec_BaseS( DEF_REC_TYPE__DefFunctionGroup ) {}
564 DefRec_DefFunctionGroupS( const uint32_t & _loccpuid,
565 const uint32_t & _deftoken, const std::string & _name )
566 : DefRec_BaseS( DEF_REC_TYPE__DefFunctionGroup, _loccpuid, _deftoken ),
567 name( _name ) {}
568
569 #ifdef VT_MPI
570 VT_MPI_INT getPackSize();
571 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
572 VT_MPI_INT & bufferPos );
573 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
574 VT_MPI_INT & bufferPos );
575 #endif // VT_MPI
576
577 // operator for searching
578 bool operator<( const DefRec_DefFunctionGroupS & a ) const
579 {
580 return name < a.name;
581 }
582
583 std::string name;
584
585 };
586
587 //
588 // DefRec_DefFunctionS
589 //
590 struct DefRec_DefFunctionS : DefRec_BaseS
591 {
592 DefRec_DefFunctionS()
593 : DefRec_BaseS( DEF_REC_TYPE__DefFunction ),
594 group( 0 ), scltoken( 0 ) {}
595 DefRec_DefFunctionS(const uint32_t & _loccpuid, const uint32_t & _deftoken,
596 const std::string & _name, const uint32_t & _group,
597 const uint32_t & _scltoken )
598 : DefRec_BaseS( DEF_REC_TYPE__DefFunction, _loccpuid, _deftoken ),
599 name( _name ), group( _group ), scltoken( _scltoken ) {}
600
601 #ifdef VT_MPI
602 VT_MPI_INT getPackSize();
603 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
604 VT_MPI_INT & bufferPos );
605 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
606 VT_MPI_INT & bufferPos );
607 #endif // VT_MPI
608
609 // operator for searching
610 bool operator<( const DefRec_DefFunctionS & a ) const
611 {
612 if( group == a.group )
613 {
614 if( scltoken == a.scltoken )
615 {
616 return name < a.name;
617 }
618 else
619 {
620 return scltoken < a.scltoken;
621 }
622 }
623 else
624 {
625 return group < a.group;
626 }
627 }
628
629 std::string name;
630 uint32_t group;
631 uint32_t scltoken;
632
633 };
634
635 //
636 // DefRec_DefCollOpS
637 //
638 struct DefRec_DefCollOpS : DefRec_BaseS
639 {
640 DefRec_DefCollOpS()
641 : DefRec_BaseS( DEF_REC_TYPE__DefCollOp ),
642 type( 0 ) {}
643 DefRec_DefCollOpS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
644 const std::string & _name, const uint32_t & _type)
645 : DefRec_BaseS( DEF_REC_TYPE__DefCollOp, _loccpuid, _deftoken ),
646 name( _name ), type( _type ) {}
647
648 #ifdef VT_MPI
649 VT_MPI_INT getPackSize();
650 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
651 VT_MPI_INT & bufferPos );
652 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
653 VT_MPI_INT & bufferPos );
654 #endif // VT_MPI
655
656 // operator for searching
657 bool operator<( const DefRec_DefCollOpS & a ) const
658 {
659 if( type == a.type )
660 return name < a.name;
661 else
662 return type < a.type;
663 }
664
665 std::string name;
666 uint32_t type;
667
668 };
669
670 //
671 // DefRec_DefCounterGroupS
672 //
673 struct DefRec_DefCounterGroupS : DefRec_BaseS
674 {
675 DefRec_DefCounterGroupS()
676 : DefRec_BaseS( DEF_REC_TYPE__DefCounterGroup ) {}
677 DefRec_DefCounterGroupS( const uint32_t & _loccpuid,
678 const uint32_t & _deftoken, const std::string & _name)
679 : DefRec_BaseS( DEF_REC_TYPE__DefCounterGroup, _loccpuid, _deftoken ),
680 name( _name ) {}
681
682 #ifdef VT_MPI
683 VT_MPI_INT getPackSize();
684 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
685 VT_MPI_INT & bufferPos );
686 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
687 VT_MPI_INT & bufferPos );
688 #endif // VT_MPI
689
690 // operator for searching
691 bool operator<( const DefRec_DefCounterGroupS & a ) const
692 {
693 return name < a.name;
694 }
695
696 std::string name;
697
698 };
699
700 //
701 // DefRec_DefCounterS
702 //
703 struct DefRec_DefCounterS : DefRec_BaseS
704 {
705 DefRec_DefCounterS()
706 : DefRec_BaseS( DEF_REC_TYPE__DefCounter ),
707 properties( 0 ), group( 0 ) {}
708 DefRec_DefCounterS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
709 const std::string & _name, const uint32_t & _properties,
710 const uint32_t & _group, const std::string & _unit)
711 : DefRec_BaseS( DEF_REC_TYPE__DefCounter, _loccpuid, _deftoken ),
712 name( _name ), properties( _properties ), group( _group ),
713 unit( _unit ) {}
714
715 #ifdef VT_MPI
716 VT_MPI_INT getPackSize();
717 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
718 VT_MPI_INT & bufferPos );
719 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
720 VT_MPI_INT & bufferPos );
721 #endif // VT_MPI
722
723 // operator for searching
724 bool operator<( const DefRec_DefCounterS & a ) const
725 {
726 if( properties == a.properties )
727 {
728 if( group == a.group )
729 {
730 if( name == a.name )
731 {
732 return unit < a.unit;
733 }
734 else
735 {
736 return name < a.name;
737 }
738 }
739 else
740 {
741 return group < a.group;
742 }
743 }
744 else
745 {
746 return properties < a.properties;
747 }
748 }
749
750 std::string name;
751 uint32_t properties;
752 uint32_t group;
753 std::string unit;
754
755 };
756
757 //
758 // DefRec_DefCounterAssignmentsS
759 //
760 struct DefRec_DefCounterAssignmentsS : DefRec_BaseS
761 {
762 DefRec_DefCounterAssignmentsS()
763 : DefRec_BaseS( DEF_REC_TYPE__DefCounterAssignments ) {}
764 DefRec_DefCounterAssignmentsS( const uint32_t & _loccpuid,
765 const uint32_t & _counter, const uint32_t & _group )
766 : DefRec_BaseS( DEF_REC_TYPE__DefCounterAssignments, _loccpuid, _counter )
767 {
768 groups.insert( _group );
769 }
770 DefRec_DefCounterAssignmentsS( const uint32_t & _loccpuid,
771 const uint32_t & _counter, const std::set<uint32_t> & _groups )
772 : DefRec_BaseS( DEF_REC_TYPE__DefCounterAssignments, _loccpuid,
773 _counter ), groups( _groups ) {}
774
775 #ifdef VT_MPI
776 VT_MPI_INT getPackSize();
777 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
778 VT_MPI_INT & bufferPos );
779 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
780 VT_MPI_INT & bufferPos );
781 #endif // VT_MPI
782
783 std::set<uint32_t> groups;
784
785 };
786
787 //
788 // DefRec_DefKeyValueS
789 //
790 struct DefRec_DefKeyValueS : DefRec_BaseS
791 {
792 DefRec_DefKeyValueS()
793 : DefRec_BaseS( DEF_REC_TYPE__DefKeyValue ),
794 type( OTF_UNKNOWN ) {}
795 DefRec_DefKeyValueS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
796 const OTF_Type & _type, const std::string & _name )
797 : DefRec_BaseS( DEF_REC_TYPE__DefKeyValue, _loccpuid, _deftoken ),
798 type( _type ), name( _name ) {}
799
800 #ifdef VT_MPI
801 VT_MPI_INT getPackSize();
802 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
803 VT_MPI_INT & bufferPos );
804 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
805 VT_MPI_INT & bufferPos );
806 #endif // VT_MPI
807
808 // operator for searching
809 bool operator<( const DefRec_DefKeyValueS & a ) const
810 {
811 if( type == a.type )
812 return name < a.name;
813 else
814 return type < a.type;
815 }
816
817 OTF_Type type;
818 std::string name;
819
820 };
821
822 //
823 // DefRec_DefMarkerS
824 //
825 struct DefRec_DefMarkerS: DefRec_BaseS
826 {
827 //
828 // compare structure for final sort
829 //
830 struct SortS
831 {
832 bool operator()( const DefRec_DefMarkerS * a,
833 const DefRec_DefMarkerS * b ) const
834 {
835 if( a->type == b->type )
836 return a->deftoken < b->deftoken;
837 else
838 return a->type < b->type;
839 }
840
841 };
842
843 DefRec_DefMarkerS()
844 : DefRec_BaseS( DEF_REC_TYPE__DefMarker ),
845 type( 0 ) {}
846 DefRec_DefMarkerS( const uint32_t & _loccpuid, const uint32_t & _deftoken,
847 const uint32_t & _type, const std::string & _name)
848 : DefRec_BaseS( DEF_REC_TYPE__DefMarker, _loccpuid, _deftoken ),
849 type( _type ), name( _name ) {}
850
851 #ifdef VT_MPI
852 VT_MPI_INT getPackSize();
853 void pack( char *& buffer, const VT_MPI_INT & bufferSize,
854 VT_MPI_INT & bufferPos );
855 void unpack( char *& buffer, const VT_MPI_INT & bufferSize,
856 VT_MPI_INT & bufferPos );
857 #endif // VT_MPI
858
859 // operator for searching
860 bool operator<( const DefRec_DefMarkerS & a ) const
861 {
862 if( type == a.type )
863 return name < a.name;
864 else
865 return type < a.type;
866 }
867
868 uint32_t type;
869 std::string name;
870
871 };
872
873 // compare function for pre-sorting local definitions
874 inline bool DefRec_LocCmp( const DefRec_BaseS * a, const DefRec_BaseS * b )
875 {
876 // if both are process group definitions (i.e. user created MPI comms.),
877 // sort by its local token to preserve the order of creation
878 if( a->dtype == DEF_REC_TYPE__DefProcessGroup &&
879 b->dtype == DEF_REC_TYPE__DefProcessGroup )
880 return a->deftoken < b->deftoken;
881 // otherwise, sort by definition type
882 else
883 return a->dtype < b->dtype;
884 }
885
886 #endif // _VT_UNIFY_DEFS_RECS_H_
DefRec_DefCreatorS
Definition: vt_unify_defs_recs.h:165
DefRec_DefCounterGroupS
Definition: vt_unify_defs_recs.h:673
DefRec_DefProcessS
Definition: vt_unify_defs_recs.h:238
DefRec_DefCommentS
Definition: vt_unify_defs_recs.h:109
DefRec_BaseS::SortS
Definition: vt_unify_defs_recs.h:68
DefRec_DefFileS
Definition: vt_unify_defs_recs.h:525
otf.h
Main include file for applications using OTF.
DefRec_DefMarkerS::SortS
Definition: vt_unify_defs_recs.h:830
DefRec_DefProcessS::SortS
Definition: vt_unify_defs_recs.h:243
DefRec_DefProcessGroupAttributesS
Definition: vt_unify_defs_recs.h:399
DefRec_DefSclS
Definition: vt_unify_defs_recs.h:460
DefRec_DefCounterAssignmentsS
Definition: vt_unify_defs_recs.h:760
DefRec_DefFileGroupS
Definition: vt_unify_defs_recs.h:495
DefRec_BaseS
Definition: vt_unify_defs_recs.h:63
DefRec_DefFunctionGroupS
Definition: vt_unify_defs_recs.h:560
OTF_Type
enum OTF_Type_enum OTF_Type
An enum which holds all OTF datatypes that are relevant for OTF_KeyValueList.
DefRec_DefTimeRangeS
Definition: vt_unify_defs_recs.h:212
DefRec_DefSclFileS
Definition: vt_unify_defs_recs.h:430
DefRec_DefKeyValueS
Definition: vt_unify_defs_recs.h:790
DefRec_DefProcessGroupS
Definition: vt_unify_defs_recs.h:291
DefRec_DefTimerResolutionS
Definition: vt_unify_defs_recs.h:188
DefRec_DefFunctionS
Definition: vt_unify_defs_recs.h:590
DefRec_DefCounterS
Definition: vt_unify_defs_recs.h:703
DefRec_DefCommentS::SortS
Definition: vt_unify_defs_recs.h:114
DefRec_DefMarkerS
Definition: vt_unify_defs_recs.h:825
DefRec_DefCollOpS
Definition: vt_unify_defs_recs.h:638