Support printing of thread active state for performance analysis.

This commit is contained in:
cdkersey
2015-09-30 15:23:17 -06:00
parent edae99d47e
commit eccf785cc2
2 changed files with 14 additions and 1 deletions

View File

@@ -1,7 +1,7 @@
################################################################################ ################################################################################
# HARPtools by Chad D. Kersey, Summer 2011 # # HARPtools by Chad D. Kersey, Summer 2011 #
################################################################################ ################################################################################
CXXFLAGS ?= -fPIC -O3 # -g -DUSE_DEBUG=3 CXXFLAGS ?= -fPIC -O3 # -g -DUSE_DEBUG=3 -DPRINT_ACTIVE_THREADS
LDLIBS ?= -pthread LDLIBS ?= -pthread
PREFIX ?= /usr/local PREFIX ?= /usr/local

View File

@@ -46,13 +46,26 @@ bool Core::interrupt(Word r0) {
void Core::step() { void Core::step() {
++steps; ++steps;
#ifdef PRINT_ACTIVE_THREADS
cout << endl << "Threads:";
#endif
for (unsigned i = 0; i < w.size(); ++i) { for (unsigned i = 0; i < w.size(); ++i) {
if (w[i].activeThreads) { if (w[i].activeThreads) {
D(3, "Core step stepping warp " << i << '[' << w[i].activeThreads << ']'); D(3, "Core step stepping warp " << i << '[' << w[i].activeThreads << ']');
w[i].step(); w[i].step();
D(3, "Now " << w[i].activeThreads << " active threads in " << i); D(3, "Now " << w[i].activeThreads << " active threads in " << i);
} }
#ifdef PRINT_ACTIVE_THREADSx
for (unsigned j = 0; j < w[i].tmask.size(); ++j) {
if (w[i].activeThreads > j && w[i].tmask[j]) cout << " 1";
else cout << " 0";
if (j != w[i].tmask.size()-1 || i != w.size()-1) cout << ',';
} }
#endif
}
cout << endl;
} }
bool Core::running() const { bool Core::running() const {