1
0
mirror of https://github.com/paboyle/Grid.git synced 2025-12-28 00:14:44 +00:00

Hadrons: can trace which module is throwing an error

This commit is contained in:
2018-04-13 18:45:31 +02:00
parent 4669ecd4ba
commit 334da7f452
3 changed files with 27 additions and 7 deletions

View File

@@ -250,6 +250,11 @@ std::string VirtualMachine::getModuleNamespace(const std::string name) const
return getModuleNamespace(getModuleAddress(name));
}
int VirtualMachine::getCurrentModule(void) const
{
return currentModule_;
}
bool VirtualMachine::hasModule(const unsigned int address) const
{
return (address < module_.size());
@@ -468,7 +473,9 @@ void VirtualMachine::memoryProfile(const unsigned int address)
<< "' (" << address << ")..." << std::endl;
try
{
currentModule_ = address;
m->setup();
currentModule_ = -1;
updateProfile(address);
}
catch (Exceptions::Definition &)
@@ -622,7 +629,7 @@ VirtualMachine::Program VirtualMachine::schedule(const GeneticPar &par)
#define SEP "---------------"
#define MEM_MSG(size) sizeString(size)
void VirtualMachine::executeProgram(const Program &p) const
void VirtualMachine::executeProgram(const Program &p)
{
Size memPeak = 0, sizeBefore, sizeAfter;
GarbageSchedule freeProg;
@@ -650,7 +657,9 @@ void VirtualMachine::executeProgram(const Program &p) const
LOG(Message) << SEP << " Measurement step " << i + 1 << "/"
<< p.size() << " (module '" << module_[p[i]].name
<< "') " << SEP << std::endl;
currentModule_ = p[i];
(*module_[p[i]].data)();
currentModule_ = -1;
sizeBefore = env().getTotalSize();
// print used memory after execution
LOG(Message) << "Allocated objects: " << MEM_MSG(sizeBefore)
@@ -679,7 +688,7 @@ void VirtualMachine::executeProgram(const Program &p) const
}
}
void VirtualMachine::executeProgram(const std::vector<std::string> &p) const
void VirtualMachine::executeProgram(const std::vector<std::string> &p)
{
Program pAddress;