Hi, in the function Profiler::profileConflictingRequests() of
profiler/Profiler.C, the variable last_time is shadowed by the
redefinition of itself inside the "if":
void Profiler::profileConflictingRequests(const Address& addr)
{
assert(addr == line_address(addr));
Time last_time = m_ruby_start;
if (m_conflicting_map_ptr->exist(addr)) {
Time last_time = m_conflicting_map_ptr->lookup(addr);
}
Time current_time = g_eventQueue_ptr->getTime();
assert (current_time - last_time > 0);
m_conflicting_histogram.add(current_time - last_time);
m_conflicting_map_ptr->add(addr, current_time);
}
This makes the "if" a no-op. The patch attached unshadows it, which, I
think, is the correct behavior. I don't currently use the
conflicting_histogram, but maybe somebody find this useful.
Hope This Helps,
Javier Merino
diff -r 93cd4bd37bf9 ruby/profiler/Profiler.C
--- a/ruby/profiler/Profiler.C Thu Apr 03 12:50:17 2008 +0200
+++ b/ruby/profiler/Profiler.C Thu Apr 03 12:50:27 2008 +0200
@@ -1142,7 +1142,7 @@ void Profiler::profileConflictingRequest
assert(addr == line_address(addr));
Time last_time = m_ruby_start;
if (m_conflicting_map_ptr->exist(addr)) {
- Time last_time = m_conflicting_map_ptr->lookup(addr);
+ last_time = m_conflicting_map_ptr->lookup(addr);
}
Time current_time = g_eventQueue_ptr->getTime();
assert (current_time - last_time > 0);
|