Skip to content

Commit

Permalink
format + js bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
hsirkar committed Mar 30, 2024
1 parent 7a1a4fd commit ce010e0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
13 changes: 8 additions & 5 deletions pipit/vis/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def plot_timeline(

# Prepare data to be plotted
events, y_tuples, num_ys = prepare_data(trace, show_depth, instant_events)

# Define the 3 data sources (Bokeh ColumnDataSource)
hbar_source = ColumnDataSource(events.head(0))
scatter_source = ColumnDataSource(events.head(0))
Expand All @@ -235,9 +235,12 @@ def plot_timeline(
if x_start is None:
x_start = events["Timestamp (ns)"].min()
if x_end is None:
x_end = events["Timestamp (ns)"].max() + (events["Timestamp (ns)"].max() - events["Timestamp (ns)"].min()) * 0.05
x_end = (
events["Timestamp (ns)"].max()
+ (events["Timestamp (ns)"].max() - events["Timestamp (ns)"].min()) * 0.05
)

plot_height = 120 + 22 * num_ys
plot_height = 140 + 22 * num_ys
p = figure(
x_range=(x_start, x_end),
y_range=(num_ys - 0.5, -0.5),
Expand Down Expand Up @@ -336,9 +339,9 @@ def plot_timeline(
for i in range(len(df) - 1):
p.add_layout(
Arrow(
end=OpenHead(line_color="black", line_width=1.5, size=5),
end=OpenHead(line_color="black", line_width=2, size=9),
line_color="black",
line_width=1.5,
line_width=2,
x_start=df["Timestamp (ns)"].iloc[i],
y_start=df["Process"].iloc[i],
x_end=df["Timestamp (ns)"].iloc[i + 1],
Expand Down
6 changes: 5 additions & 1 deletion pipit/vis/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def format_time(n: float) -> str:
var str = "";
if (ms) str += ms + "ms ";
if (us) str += Math.round(us) + "us";
else str += "0us";
return str;
}
Expand All @@ -114,6 +115,7 @@ def format_time(n: float) -> str:
if (ms) str += ms + "ms ";
if (us) str += us + "us ";
if (ns) str += ns + "ns";
else if (!us) str += "0ns";
return str;
"""
Expand Down Expand Up @@ -375,7 +377,7 @@ def get_height(num_yticks, height_per_tick=400):

LIGHT = [
"#aec7e8",
"#ffbb78",
# "#ffbb78", # reserved for sim_life_1d
"#98df8a",
"#ff9896",
"#c5b0d5",
Expand Down Expand Up @@ -423,6 +425,8 @@ def get_palette(trace, scale=None):
palette["MPI_Waitall"] = "#c7c7c7"
palette["Idle"] = "#c7c7c7"

palette["sim_life_1d"] = "#ffbb78"

dark_index = 0
light_index = 0

Expand Down

0 comments on commit ce010e0

Please sign in to comment.