-
-
Save cpearce/02bd08e480863c2612d1a1e1d8f5f41b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env python | |
import json | |
import sys | |
skipList = [ | |
"BaseThreadInitThunk", | |
"CharPrevA", | |
"CsrAllocateMessagePointer", | |
"DispatchMessageW", | |
"DispatchMessageWorker", | |
"EtwEventEnabled", | |
"GetCurrentThread", | |
"GetTickCount", | |
"KiFastSystemCallRet", | |
"MessageLoop::Run", | |
"MessageLoop::RunHandler", | |
"MsgWaitForMultipleObjects", | |
"MsgWaitForMultipleObjectsEx", | |
"NS_ProcessNextEvent", | |
"NS_internal_main", | |
"NtUserValidateHandleSecure", | |
"NtWaitForAlertByThreadId", | |
"NtWaitForMultipleObjects", | |
"NtWaitForSingleObject", | |
"PR_Lock", | |
"PeekMessageW", | |
"RealMsgWaitForMultipleObjectsEx", | |
"RtlAnsiStringToUnicodeString", | |
"RtlDeNormalizeProcessParams", | |
"RtlEnterCriticalSection", | |
"RtlLeaveCriticalSection", | |
"RtlUserThreadStart", | |
"RtlpAllocateListLookup", | |
"RtlpDeCommitFreeBlock", | |
"RtlpEnterCriticalSectionContended", | |
"RtlpUnWaitCriticalSection", | |
"RtlpWaitOnAddress", | |
"RtlpWaitOnAddressWithTimeout", | |
"RtlpWaitOnCriticalSection", | |
"RtlpWakeByAddress", | |
"UserCallWinProcCheckWow" | |
"ValidateHwnd", | |
"WaitForMultipleObjectsEx", | |
"WaitForMultipleObjectsExImplementation", | |
"WaitForSingleObjectEx", | |
"XRE_InitChildProcess", | |
"XRE_RunAppShell", | |
"ZwWaitForMultipleObjects", | |
"ZwWaitForSingleObject", | |
"_RtlUserThreadStart", | |
"__RtlUserThreadStart", | |
"__scrt_common_main_seh", | |
"content_process_main", | |
"mozilla::BackgroundHangMonitor::NotifyActivity", | |
"mozilla::BackgroundHangThread::NotifyActivity", | |
"mozilla::BackgroundHangThread::NotifyWait", | |
"mozilla::BootstrapImpl::XRE_InitChildProcess", | |
"mozilla::HangMonitor::NotifyActivity", | |
"mozilla::HangMonitor::Suspend", | |
"mozilla::ValidatingDispatcher::Runnable::Run", | |
"mozilla::detail::MutexImpl::lock", | |
"mozilla::ipc::MessageChannel::MessageTask::Run", | |
"mozilla::ipc::MessagePump::Run", | |
"mozilla::ipc::MessagePumpForChildProcess::Run", | |
"mozilla::widget::WinUtils::PeekMessageW", | |
"mozilla::widget::WinUtils::WaitForMessage", | |
"nsAppShell::ProcessNextNativeEvent", | |
"nsAppShell::Run", | |
"nsBaseAppShell::DoProcessNextNativeEvent", | |
"nsBaseAppShell::OnProcessNextEvent", | |
"nsBaseAppShell::Run", | |
"nsThread::DoMainThreadSpecificProcessing", | |
"nsThread::ProcessNextEvent", | |
"wmain", | |
"UserCallWinProcCheckWow", | |
"ValidateHwnd", | |
"0x1bc3d", | |
"0x1905a", | |
"RtlSleepConditionVariableCS", | |
"SleepConditionVariableCS", | |
"NDXGI::CDevice::GetKernelDeviceExecutionState", | |
"NtGdiDdDDIGetDeviceState", | |
] | |
def shouldSkip(frame): | |
for item in skipList: | |
if frame.startswith(item): | |
return True | |
return False | |
def filterStacks(stacks): | |
newstacks = [] | |
for frame in stacks: | |
if shouldSkip(frame): | |
continue | |
newstacks.append(frame) | |
return newstacks | |
if __name__ == "__main__": | |
input = sys.argv[1] | |
data = json.load(open(input)) | |
ranks = {} | |
for record in data: | |
stacks = filterStacks(record['nativeStack']['symbolicatedStacks'][0]) | |
key = ''.join(stacks) | |
if stacks: | |
if not ranks.has_key(key): | |
ranks[key] = [] | |
ranks[key].append(stacks) | |
for r in sorted(ranks.itervalues(), key=lambda r: len(r), reverse=True): | |
print("{}".format(len(r))) | |
for frame in r[0]: | |
print(" {}".format(frame)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment