-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Keep dictionary of edges with counts. also created quick script to di…
…vide scaled flame graphs by 1000
- Loading branch information
1 parent
6232f2a
commit a0cccd4
Showing
3 changed files
with
45 additions
and
5 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import os | ||
import sys | ||
|
||
# Takes in a flame graph svg that is scaled by 1000 and prints a version with fixed cycles. | ||
|
||
def main(svg_in): | ||
oin = open(svg_in, "r") | ||
|
||
for line in oin: | ||
if line.startswith("<title>"): | ||
line_split = line.strip().split(" ") | ||
target_idx = 0 | ||
for i in range(len(line_split)): | ||
if line_split[i] == "cycles,": | ||
target_idx = i-1 | ||
new_number = int(line_split[target_idx].split("(")[1].replace(",", "")) / 1000 | ||
print(" ".join(line_split[0:target_idx]) + " (" + str(new_number) + " " + " ".join(line_split[target_idx+1:])) | ||
else: | ||
print(line.strip()) | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) > 1: | ||
svg_filename = sys.argv[1] | ||
main(svg_filename) | ||
else: | ||
args_desc = [ | ||
"INPUT_SVG" | ||
] | ||
print(f"Usage: {sys.argv[0]} {' '.join(args_desc)}") | ||
print("CELLS_JSON: Run the `component_cells` tool") | ||
sys.exit(-1) |
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
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