Ignore:
Timestamp:
Apr 29, 2008, 11:09:04 AM (17 years ago)
Author:
[email protected]
Message:

2008-04-29 Kevin McCullough <[email protected]>

Reviewed by Geoff.

-<rdar://problem/5770054> JavaScript profiler (10928)
-Keep call count.

  • profiler/FunctionCallProfile.cpp: (KJS::FunctionCallProfile::FunctionCallProfile): (KJS::FunctionCallProfile::didExecute): Implements call count and fixed a bug where a stackIndex of 0 was causing the assert to be hit. (KJS::FunctionCallProfile::stopProfiling): (KJS::FunctionCallProfile::endAndRecordCall):
  • profiler/FunctionCallProfile.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/profiler/FunctionCallProfile.cpp

    r32354 r32693  
    4040    : m_functionName(name)
    4141    , m_timeSum(0)
     42    , m_numberOfCalls(0)
    4243{
    4344    m_startTime = getCurrentUTCTime();
     
    5758void FunctionCallProfile::didExecute(Vector<UString> stackNames, unsigned int stackIndex)
    5859{
    59     if (stackIndex == stackNames.size()) {
     60    if (stackIndex && stackIndex == stackNames.size()) {
    6061        ASSERT(stackNames[stackIndex - 1] == m_functionName);
    61 
    62         m_timeSum += getCurrentUTCTime() - m_startTime;
    63         m_startTime = 0.0;
    64 
    65         // FIXME: We may need something with higher resolution than ms as some functions will take 0ms.
     62        endAndRecordCall();
    6663        return;
    6764    }
     
    10198{
    10299    if (m_startTime)
    103         m_timeSum += getCurrentUTCTime() - m_startTime;
     100        endAndRecordCall();
    104101
    105102    StackIterator endOfChildren = m_children.end();
     
    160157}
    161158
     159void FunctionCallProfile::endAndRecordCall()
     160{
     161    m_timeSum += getCurrentUTCTime() - m_startTime;
     162    m_startTime = 0.0;
     163
     164    ++m_numberOfCalls;
     165}
     166
    162167}   // namespace KJS
Note: See TracChangeset for help on using the changeset viewer.