Skip to content

Commit

Permalink
Fix flame graphs for Chromium's perl
Browse files Browse the repository at this point in the history
The version of perl that ships with Chromium's depot_tools can't handle
CRLF endings on text files, so I've modified xperf_to_collapsedstacks.py
to write the collapsed stacks in binary mode.

Also, there was a missing parameter to a format-string function.
  • Loading branch information
randomascii committed Oct 14, 2015
1 parent e7d5849 commit 311717f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion UIforETW/UIforETWDlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1891,7 +1891,7 @@ void CUIforETWDlg::CreateFlameGraph(const std::wstring& traceFilename)
{
outputPrintf(L"\nCreating CPU Usage (Sampled) flame graph of busiest process in %s "
L"(requires python, perl and flamegraph.pl). UIforETW will hang while "
L"this is calculated...\n");
L"this is calculated...\n", traceFilename.c_str());

This comment has been minimized.

Copy link
@ariccio

ariccio Oct 15, 2015

Contributor

Huh.../analyze missed this?

This comment has been minimized.

Copy link
@randomascii

randomascii Oct 15, 2015

Author Contributor

It only finds bugs if you run it.

Running /analyze from package_etw.bat is on my to-do list. That is the best way to ensure that at least I don't create releases with embarrassing bugs like that.

std::wstring pythonPath = FindPython();
if (!pythonPath.empty())
{
Expand Down
7 changes: 5 additions & 2 deletions bin/xperf_to_collapsedstacks.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015 Google Inc. All Rights Reserved.
# Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -156,7 +156,10 @@
for stack in threadSamples:
sortedStacks.append("%s %d\n" % (stack, threadSamples[stack]))
sortedStacks.sort()
out = open(outputName, "wt")
# Some versions of perl (the version that ships with Chromium's depot_tools
# for one) can't handle reading files with CRLF line endings, so write the
# file as binary to avoid line-ending translation.
out = open(outputName, "wb")
for stack in sortedStacks:
out.write(stack)
# Force the file closed so that the results will be available when we the
Expand Down

0 comments on commit 311717f

Please sign in to comment.