comparison base/Profiler.cpp @ 26:090c22aa726a

* Add the Note layer for pianoroll-type display of note-type data * Complete the MIDI file importer (well, nearly -- it would be nice to be able to import the non-note data as other sorts of models, and that's not done yet). * Minor refactoring in RealTime etc
author Chris Cannam
date Fri, 10 Feb 2006 17:51:36 +0000
parents 2fb933f88604
children 39ae3dee27b9
comparison
equal deleted inserted replaced
25:7dad8a310963 26:090c22aa726a
110 #ifndef NO_TIMING 110 #ifndef NO_TIMING
111 m_startCPU = clock(); 111 m_startCPU = clock();
112 112
113 struct timeval tv; 113 struct timeval tv;
114 (void)gettimeofday(&tv, 0); 114 (void)gettimeofday(&tv, 0);
115 m_startTime = RealTime(tv.tv_sec, tv.tv_usec * 1000); 115 m_startTime = RealTime::fromTimeval(tv);
116 #endif 116 #endif
117 } 117 }
118 118
119 void 119 void
120 Profiler::update() 120 Profiler::update()
122 #ifndef NO_TIMING 122 #ifndef NO_TIMING
123 clock_t elapsedCPU = clock() - m_startCPU; 123 clock_t elapsedCPU = clock() - m_startCPU;
124 124
125 struct timeval tv; 125 struct timeval tv;
126 (void)gettimeofday(&tv, 0); 126 (void)gettimeofday(&tv, 0);
127 RealTime elapsedTime = RealTime(tv.tv_sec, tv.tv_usec * 1000) - m_startTime; 127 RealTime elapsedTime = RealTime::fromTimeval(tv) - m_startTime;
128 128
129 cerr << "Profiler : id = " << m_c 129 cerr << "Profiler : id = " << m_c
130 << " - elapsed so far = " << ((elapsedCPU * 1000) / CLOCKS_PER_SEC) 130 << " - elapsed so far = " << ((elapsedCPU * 1000) / CLOCKS_PER_SEC)
131 << "ms CPU, " << elapsedTime << " real" << endl; 131 << "ms CPU, " << elapsedTime << " real" << endl;
132 #endif 132 #endif
137 #ifndef NO_TIMING 137 #ifndef NO_TIMING
138 clock_t elapsedCPU = clock() - m_startCPU; 138 clock_t elapsedCPU = clock() - m_startCPU;
139 139
140 struct timeval tv; 140 struct timeval tv;
141 (void)gettimeofday(&tv, 0); 141 (void)gettimeofday(&tv, 0);
142 RealTime elapsedTime = RealTime(tv.tv_sec, tv.tv_usec * 1000) - m_startTime; 142 RealTime elapsedTime = RealTime::fromTimeval(tv) - m_startTime;
143 143
144 Profiles::getInstance()->accumulate(m_c, elapsedCPU, elapsedTime); 144 Profiles::getInstance()->accumulate(m_c, elapsedCPU, elapsedTime);
145 145
146 if (m_showOnDestruct) 146 if (m_showOnDestruct)
147 cerr << "Profiler : id = " << m_c 147 cerr << "Profiler : id = " << m_c