OpenMPI  0.1.1
Treehash.h
1 /*
2  This is part of the OTF library. Copyright by ZIH, TU Dresden 2005-2012.
3  Authors: Andreas Knuepfer, Holger Brunst, Ronny Brendel, Thomas Kriebitzsch
4 */
5 
6 #ifndef OTFTOVTF3_TREEHASH_H
7 #define OTFTOVTF3_TREEHASH_H
8 
9 #ifdef HAVE_CONFIG_H
10 #include "config.h"
11 #endif
12 
13 
14 #include <assert.h>
15 
16 #include "OTF_inttypes.h"
17 #include "OTF_Platform.h"
18 
19 
20 #define STACK_ALLOC_WIDTH 10
21 
22 
23 /* *** queue of FileIOEnd records *********************/
24 typedef struct FileIOEndRecord_s {
25 
26  uint64_t time;
27  uint32_t process;
28  int iotype;
29  int fileid;
30  uint32_t bytes;
31  int source;
32 
33  struct FileIOEndRecord_s* next;
34 
36 
37 
38 /* *** tree structure *******************************/
39 typedef struct nodeS
40 {
41  uint32_t process; /* cpu token of otf */
42  uint32_t processi; /* index of cpu for vtf3 */
43  char *name; /* process name */
44  int childrensize; /* sizeof children vector */
45  struct nodeS **p_children; /* vector of children */
46 
47  /* function stack */
48  uint32_t *stack;
49  uint32_t stackc;
50  uint32_t stacks;
51 
52 }nodeT;
53 
54 /* *** hash structures *******************************/
55 typedef struct entryvecS
56 {
57  nodeT *p_node; /* pointer to the treenode */
58 }entryvecT;
59 
60 typedef struct hashtabS
61 {
62  nodeT *p_node;
63 
64  int entryvecsize;
65  entryvecT * p_entryvec;
66 }hashtabT;
67 
68 typedef struct {
69 
70  void *fcb;
71  hashtabT *p_hashtab;
72  FileIOEndRecord* FileIOQueue;
73 
74 }fcbT;
75 
76 /* *** FileIOEndQueue functions *************************/
77 /* init */
78 FileIOEndRecord* FileIOEndQueue_init( void );
79 
80 
81 void FileIOEndQueue_finish( FileIOEndRecord** queue );
82 
83 /* check if there are events matching the current timestamp */
84 void FileIOEndQueue_check( FileIOEndRecord** queue, uint64_t time, void* fha );
85 
86 /* add an element at the end */
87 void FileIOEndQueue_push( FileIOEndRecord** queue, FileIOEndRecord* append );
88 
89 
90 /* *** treehash functions *******************************/
91 
92 /* initialize the tree and the hash */
93 void treehash_init( nodeT **pp_root, hashtabT **pp_hashtab );
94 
95 /* add a node to the tree and hash */
96 int treehash_addnode( hashtabT *p_hashtab, uint32_t process, const char* name, uint32_t parent );
97 
98 /* search a node using the hash */
99 nodeT *treehash_searchnode ( hashtabT *p_hashtab, uint32_t process );
100 
101 /* search the entryvector of a tree (binary search) -- only used intern -- */
102 nodeT *treehash_searchvec ( entryvecT* vec, int vecsize, uint32_t process );
103 
104 /* create indices (treeform -> linear for vtf3 */
105 int treehash_createindices ( int index, nodeT *p_node );
106 
107 /* free all memory ... */
108 void treehash_deleteall ( hashtabT *p_hashtab );
109 
110 /* free a treenode */
111 void treehash_deletenode ( nodeT *p_node );
112 
113 #endif /* OTFTOVTF3_TREEHASH_H */
Definition: Treehash.h:39
Definition: Treehash.h:24
Definition: Treehash.h:68
Definition: Treehash.h:55
Definition: Treehash.h:60
Deals with platform dependend issues.
Deals with all data type related issues.