OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2010 Google Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "InspectorFrontend.h" | 39 #include "InspectorFrontend.h" |
40 #include "InspectorState.h" | 40 #include "InspectorState.h" |
41 #include "InspectorValues.h" | 41 #include "InspectorValues.h" |
42 #include "InstrumentingAgents.h" | 42 #include "InstrumentingAgents.h" |
43 #include "KURL.h" | 43 #include "KURL.h" |
44 #include "Page.h" | 44 #include "Page.h" |
45 #include "PageScriptDebugServer.h" | 45 #include "PageScriptDebugServer.h" |
46 #include "ScriptObject.h" | 46 #include "ScriptObject.h" |
47 #include "ScriptProfile.h" | 47 #include "ScriptProfile.h" |
48 #include "ScriptProfiler.h" | 48 #include "ScriptProfiler.h" |
49 #include "WebCoreMemoryInstrumentation.h" | |
50 #include "WorkerScriptDebugServer.h" | 49 #include "WorkerScriptDebugServer.h" |
51 #include <wtf/CurrentTime.h> | 50 #include <wtf/CurrentTime.h> |
52 #include <wtf/MemoryInstrumentationHashMap.h> | |
53 #include <wtf/OwnPtr.h> | 51 #include <wtf/OwnPtr.h> |
54 #include <wtf/text/StringConcatenate.h> | 52 #include <wtf/text/StringConcatenate.h> |
55 | 53 |
56 namespace WebCore { | 54 namespace WebCore { |
57 | 55 |
58 namespace ProfilerAgentState { | 56 namespace ProfilerAgentState { |
59 static const char userInitiatedProfiling[] = "userInitiatedProfiling"; | 57 static const char userInitiatedProfiling[] = "userInitiatedProfiling"; |
60 static const char profilerEnabled[] = "profilerEnabled"; | 58 static const char profilerEnabled[] = "profilerEnabled"; |
61 static const char profileHeadersRequested[] = "profileHeadersRequested"; | 59 static const char profileHeadersRequested[] = "profileHeadersRequested"; |
62 } | 60 } |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); | 324 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); |
327 return profileHeader; | 325 return profileHeader; |
328 } | 326 } |
329 | 327 |
330 void InspectorProfilerAgent::toggleRecordButton(bool isProfiling) | 328 void InspectorProfilerAgent::toggleRecordButton(bool isProfiling) |
331 { | 329 { |
332 if (m_frontend) | 330 if (m_frontend) |
333 m_frontend->setRecordingProfile(isProfiling); | 331 m_frontend->setRecordingProfile(isProfiling); |
334 } | 332 } |
335 | 333 |
336 void InspectorProfilerAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjectInf
o) const | |
337 { | |
338 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorPr
ofilerAgent); | |
339 InspectorBaseAgent<InspectorProfilerAgent>::reportMemoryUsage(memoryObjectIn
fo); | |
340 info.addMember(m_consoleAgent, "consoleAgent"); | |
341 info.addMember(m_injectedScriptManager, "injectedScriptManager"); | |
342 info.addWeakPointer(m_frontend); | |
343 info.addMember(m_profiles, "profiles"); | |
344 info.addMember(m_profileNameIdleTimeMap, "profileNameIdleTimeMap"); | |
345 } | |
346 | |
347 void InspectorProfilerAgent::willProcessTask() | 334 void InspectorProfilerAgent::willProcessTask() |
348 { | 335 { |
349 if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size()) | 336 if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size()) |
350 return; | 337 return; |
351 if (!m_previousTaskEndTime) | 338 if (!m_previousTaskEndTime) |
352 return; | 339 return; |
353 | 340 |
354 double idleTime = WTF::monotonicallyIncreasingTime() - m_previousTaskEndTime
; | 341 double idleTime = WTF::monotonicallyIncreasingTime() - m_previousTaskEndTime
; |
355 m_previousTaskEndTime = 0.0; | 342 m_previousTaskEndTime = 0.0; |
356 ProfileNameIdleTimeMap::iterator end = m_profileNameIdleTimeMap->end(); | 343 ProfileNameIdleTimeMap::iterator end = m_profileNameIdleTimeMap->end(); |
357 for (ProfileNameIdleTimeMap::iterator it = m_profileNameIdleTimeMap->begin()
; it != end; ++it) | 344 for (ProfileNameIdleTimeMap::iterator it = m_profileNameIdleTimeMap->begin()
; it != end; ++it) |
358 it->value += idleTime; | 345 it->value += idleTime; |
359 } | 346 } |
360 | 347 |
361 void InspectorProfilerAgent::didProcessTask() | 348 void InspectorProfilerAgent::didProcessTask() |
362 { | 349 { |
363 if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size()) | 350 if (!m_profileNameIdleTimeMap || !m_profileNameIdleTimeMap->size()) |
364 return; | 351 return; |
365 m_previousTaskEndTime = WTF::monotonicallyIncreasingTime(); | 352 m_previousTaskEndTime = WTF::monotonicallyIncreasingTime(); |
366 } | 353 } |
367 | 354 |
368 } // namespace WebCore | 355 } // namespace WebCore |
369 | 356 |
OLD | NEW |