From 46ffcce0c355ee16075b4ba216bc0aea054143aa Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 2 Aug 2013 18:29:23 +0000 Subject: [PATCH] In the profiler output, show function names (if available) --- src/libexpr/eval.cc | 14 +++++++------- src/libexpr/eval.hh | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 766440fc6..b1100a662 100644 --- a/src/libexpr/eval.cc +++ b/src/libexpr/eval.cc @@ -788,7 +788,7 @@ void EvalState::callFunction(Value & fun, Value & arg, Value & v) } nrFunctionCalls++; - if (countCalls) functionCalls[fun.lambda.fun->pos]++; + if (countCalls) functionCalls[fun.lambda.fun]++; try { fun.lambda.fun->body->eval(*this, env2, v); @@ -1283,23 +1283,23 @@ void EvalState::printStats() printMsg(v, format("calls to %1% primops:") % primOpCalls.size()); typedef std::multimap PrimOpCalls_; - std::multimap primOpCalls_; + PrimOpCalls_ primOpCalls_; foreach (PrimOpCalls::iterator, i, primOpCalls) primOpCalls_.insert(std::pair(i->second, i->first)); foreach_reverse (PrimOpCalls_::reverse_iterator, i, primOpCalls_) printMsg(v, format("%1$10d %2%") % i->first % i->second); printMsg(v, format("calls to %1% functions:") % functionCalls.size()); - typedef std::multimap FunctionCalls_; - std::multimap functionCalls_; + typedef std::multimap FunctionCalls_; + FunctionCalls_ functionCalls_; foreach (FunctionCalls::iterator, i, functionCalls) - functionCalls_.insert(std::pair(i->second, i->first)); + functionCalls_.insert(std::pair(i->second, i->first)); foreach_reverse (FunctionCalls_::reverse_iterator, i, functionCalls_) - printMsg(v, format("%1$10d %2%") % i->first % i->second); + printMsg(v, format("%1$10d %2%") % i->first % i->second->showNamePos()); printMsg(v, format("evaluations of %1% attributes:") % attrSelects.size()); typedef std::multimap AttrSelects_; - std::multimap attrSelects_; + AttrSelects_ attrSelects_; foreach (AttrSelects::iterator, i, attrSelects) attrSelects_.insert(std::pair(i->second, i->first)); foreach_reverse (AttrSelects_::reverse_iterator, i, attrSelects_) diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh index 6f6b2a900..627eabf95 100644 --- a/src/libexpr/eval.hh +++ b/src/libexpr/eval.hh @@ -260,7 +260,7 @@ private: typedef std::map PrimOpCalls; PrimOpCalls primOpCalls; - typedef std::map FunctionCalls; + typedef std::map FunctionCalls; FunctionCalls functionCalls; typedef std::map AttrSelects;