/[escript]/trunk/escript/src/DataProf.cpp
ViewVC logotype

Contents of /trunk/escript/src/DataProf.cpp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 474 - (show annotations)
Mon Jan 30 04:23:44 2006 UTC (13 years, 8 months ago) by jgs
File size: 4458 byte(s)
restructure escript source tree
move src/Data/* -> src
remove inc
modify #includes and cpppath settings accordingly

1 /*
2 ******************************************************************************
3 * *
4 * COPYRIGHT ACcESS 2004 - All Rights Reserved *
5 * *
6 * This software is the property of ACcESS. No part of this code *
7 * may be copied in any form or by any means without the expressed written *
8 * consent of ACcESS. Copying, use or modification of this software *
9 * by any unauthorised person is illegal unless that person has a software *
10 * license agreement with ACcESS. *
11 * *
12 ******************************************************************************
13 */
14
15 #include "DataProf.h"
16
17 using namespace std;
18
19 namespace escript {
20
21 DataProf::DataProf() {
22 profDataTable_Root = 0;
23 totalDataObjects = 0;
24 }
25
26 DataProf::~DataProf() {
27
28 profDataTable* tempTable = profDataTable_Root;
29 profDataTable* lastTable;
30
31 cout << compProf() << endl;
32
33 while (tempTable != 0) {
34 lastTable = tempTable;
35 tempTable = tempTable->next;
36 delete lastTable->data;
37 delete lastTable;
38 }
39
40 totalDataObjects = -1;
41
42 }
43
44 profDataEntry*
45 DataProf::newData(){
46
47 profDataTable* tempTable;
48 profDataEntry* tempEntry;
49
50 // create the new table and entry
51 tempTable = new profDataTable;
52 tempEntry = new profDataEntry;
53
54 // add the new table to the beginning of the list
55 tempTable->next = profDataTable_Root;
56 profDataTable_Root = tempTable;
57
58 // add the new entry to the new table
59 tempTable->data = tempEntry;
60
61 // initialise the new entry
62 tempEntry->interpolate = 0;
63 tempEntry->grad = 0;
64 tempEntry->integrate = 0;
65 tempEntry->where = 0;
66 tempEntry->unary = 0;
67 tempEntry->binary = 0;
68 tempEntry->reduction1 = 0;
69 tempEntry->reduction2 = 0;
70 tempEntry->slicing = 0;
71
72 // increment the Data objects counter
73 totalDataObjects++;
74
75 // return the pointer to the new entry
76 return tempEntry;
77
78 }
79
80 std::string
81 DataProf::dumpProf(profDataEntry* entry) {
82
83 stringstream temp_str;
84
85 temp_str << "=============================\n";
86 temp_str << "interpolate: " << entry->interpolate << "\n";
87 temp_str << "grad : " << entry->grad << "\n";
88 temp_str << "integrate : " << entry->integrate << "\n";
89 temp_str << "where : " << entry->where << "\n";
90 temp_str << "unary : " << entry->unary << "\n";
91 temp_str << "binary : " << entry->binary << "\n";
92 temp_str << "reduction1 : " << entry->reduction1 << "\n";
93 temp_str << "reduction2 : " << entry->reduction2 << "\n";
94 temp_str << "slicing : " << entry->slicing << "\n";
95 temp_str << "=============================\n ";
96 temp_str << endl;
97
98 return temp_str.str();
99
100 }
101
102 string
103 DataProf::compProf() {
104
105 int comp_interpolate = 0;
106 int comp_grad = 0;
107 int comp_integrate = 0;
108 int comp_where = 0;
109 int comp_unary = 0;
110 int comp_binary = 0;
111 int comp_reduction1 = 0;
112 int comp_reduction2 = 0;
113 int comp_slicing = 0;
114
115 profDataTable* tempTable = profDataTable_Root;
116
117 while (tempTable != 0) {
118 comp_interpolate += tempTable->data->interpolate;
119 comp_grad += tempTable->data->grad;
120 comp_integrate += tempTable->data->integrate;
121 comp_where += tempTable->data->where;
122 comp_unary += tempTable->data->unary;
123 comp_binary += tempTable->data->binary;
124 comp_reduction1 += tempTable->data->reduction1;
125 comp_reduction2 += tempTable->data->reduction2;
126 comp_slicing += tempTable->data->slicing;
127 tempTable = tempTable->next;
128 }
129
130 stringstream temp_str;
131
132 temp_str << "========== Op Stats ===================\n";
133 temp_str << "Total objects: " << totalDataObjects << "\n";
134 temp_str << "interpolate : " << comp_interpolate << "\n";
135 temp_str << "grad : " << comp_grad << "\n";
136 temp_str << "integrate : " << comp_integrate << "\n";
137 temp_str << "where : " << comp_where << "\n";
138 temp_str << "unary : " << comp_unary << "\n";
139 temp_str << "binary : " << comp_binary << "\n";
140 temp_str << "reduction1 : " << comp_reduction1 << "\n";
141 temp_str << "reduction2 : " << comp_reduction2 << "\n";
142 temp_str << "slicing : " << comp_slicing << "\n";
143 temp_str << "======================================= ";
144 temp_str << endl;
145
146 return temp_str.str();
147
148 }
149
150 } // end of namespace

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.26