Support importing from instruments via deep copy (#33)
Instruments has a complex binary file format. If we're interested in just having a nice flamegraph display of the contents and don't care too much about time ordering or symbol file locations, then we can just grab the information we need from the clipboard rather than deal with the binary file format. This also avoids needing to deal with multiple processes or multiple threads. This PR contains 2 compressed `.trace` files. In each, if you select the top row in the call tree view and hit "Cmd+Shift+C" or go to "Edit -> Deep Copy", then paste into speedscope, you should get the corresponding flamechart. ## Allocations Profile   ## Time Profile  
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
simple
|
||||
simple.dSYM
|
||||
@@ -0,0 +1 @@
|
||||
*.trace
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,2 @@
|
||||
simple: simple.cpp
|
||||
g++ -Wall -g -o $@ $<
|
||||
@@ -0,0 +1,52 @@
|
||||
#include <cstdlib>
|
||||
using namespace std;
|
||||
|
||||
void leakMemory() {
|
||||
for (int i = 0; i < 100; i++) {
|
||||
malloc(1024);
|
||||
}
|
||||
}
|
||||
|
||||
void alpha() {
|
||||
leakMemory();
|
||||
int z = 3;
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
z *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
void beta() {
|
||||
leakMemory();
|
||||
int z = 3;
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
z *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
void delta() {
|
||||
leakMemory();
|
||||
int z = 3;
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
z *= 3;
|
||||
}
|
||||
alpha();
|
||||
beta();
|
||||
}
|
||||
|
||||
void gamma() {
|
||||
leakMemory();
|
||||
int z = 3;
|
||||
for (int i = 0; i < 100000; i++) {
|
||||
z *= 3;
|
||||
}
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[]) {
|
||||
while (true) {
|
||||
alpha();
|
||||
beta();
|
||||
delta();
|
||||
gamma();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user