Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ LinearAlgebra = "1"
Logging = "1"
NVTX = "1"
Preferences = "1"
PrettyTables = "2"
PrettyTables = "3"
Printf = "1"
Random = "1"
Random123 = "1.2"
Expand Down
37 changes: 19 additions & 18 deletions src/profile.jl
Original file line number Diff line number Diff line change
Expand Up @@ -660,15 +660,15 @@ function Base.show(io::IO, results::ProfileResults)
p75 = quantile(relevant_times, 0.75)
p95 = quantile(relevant_times, 0.95)

highlight_p95 = Highlighter((data, i, j) -> (names(data)[j] == "time") &&
(data[i,j] >= p95),
crayon"red")
highlight_p75 = Highlighter((data, i, j) -> (names(data)[j] == "time") &&
(data[i,j] >= p75),
crayon"yellow")
highlight_bold = Highlighter((data, i, j) -> (names(data)[j] == "name") &&
(data[!, :time][i] >= p75),
crayon"bold")
highlight_p95 = TextHighlighter((data, i, j) -> (names(data)[j] == "time") &&
(data[i,j] >= p95),
crayon"red")
highlight_p75 = TextHighlighter((data, i, j) -> (names(data)[j] == "time") &&
(data[i,j] >= p75),
crayon"yellow")
highlight_bold = TextHighlighter((data, i, j) -> (names(data)[j] == "name") &&
(data[!, :time][i] >= p75),
crayon"bold")

(highlight_p95, highlight_p75, highlight_bold)
end
Expand Down Expand Up @@ -829,8 +829,9 @@ function Base.show(io::IO, results::ProfileResults)
end
end
highlighters = time_highlighters(df)
pretty_table(io, df; header, alignment, formatters, highlighters, crop,
body_hlines=trace_divisions)
highlighters = isempty(highlighters) ? PrettyTables.TextHighlighter[] : collect(highlighters)
pretty_table(io, df; column_labels=header, alignment, formatters=[formatters], highlighters, fit_table_in_display_horizontally = (crop==:horizontal), fit_table_in_display_vertically=false)#,
#body_hlines=trace_divisions)
else
df = summarize_trace(df)

Expand All @@ -844,7 +845,7 @@ function Base.show(io::IO, results::ProfileResults)
header = [summary_column_names[name] for name in names(df)]
alignment = [name in ["name", "time_dist"] ? :l : :r for name in names(df)]
highlighters = time_highlighters(df)
pretty_table(io, df; header, alignment, formatters=summary_formatter(df), highlighters, crop)
pretty_table(io, df; column_labels=header, alignment, formatters=[summary_formatter(df)], highlighters=collect(highlighters), fit_table_in_display_horizontally=(crop==:horizontal), fit_table_in_display_vertically=false)
end
end

Expand Down Expand Up @@ -929,8 +930,8 @@ function Base.show(io::IO, results::ProfileResults)
end
end
highlighters = time_highlighters(df)
pretty_table(io, df; header, alignment, formatters, highlighters, crop,
body_hlines=trace_divisions)
pretty_table(io, df; column_labels=header, alignment, formatters=[formatters], highlighters=collect(highlighters), fit_table_in_display_horizontally=(crop==:horizontal), fit_table_in_display_vertically=false)
#body_hlines=trace_divisions)
else
df = summarize_trace(results.device)

Expand All @@ -944,7 +945,7 @@ function Base.show(io::IO, results::ProfileResults)
header = [summary_column_names[name] for name in names(df)]
alignment = [name in ["name", "time_dist"] ? :l : :r for name in names(df)]
highlighters = time_highlighters(df)
pretty_table(io, df; header, alignment, formatters=summary_formatter(df), highlighters, crop)
pretty_table(io, df; column_labels=header, alignment, formatters=[summary_formatter(df)], highlighters=collect(highlighters), fit_table_in_display_horizontally=(crop==:horizontal), fit_table_in_display_vertically=false)
end
end

Expand Down Expand Up @@ -981,7 +982,7 @@ function Base.show(io::IO, results::ProfileResults)
for color in unique(df.color)
if color !== nothing
ids = df[df.color .== color, :id]
highlighter = Highlighter(Crayon(; foreground=color)) do data, i, j
highlighter = TextHighlighter(Crayon(; foreground=color)) do data, i, j
names(data)[j] in ["name", "domain"] && data[!, :id][i] in ids
end
push!(color_highlighters, highlighter)
Expand All @@ -1002,7 +1003,7 @@ function Base.show(io::IO, results::ProfileResults)
end
end
highlighters = tuple(color_highlighters..., time_highlighters(df)...)
pretty_table(io, df; header, alignment, formatters, highlighters, crop)
pretty_table(io, df; column_labels=header, alignment, formatters=[formatters], highlighters=collect(highlighters), fit_table_in_display_horizontally=(crop==:horizontal), fit_table_in_display_vertically=false)
else
# merge the domain and name into a single column
nvtx_ranges.name = map(nvtx_ranges.name, nvtx_ranges.domain) do name, domain
Expand All @@ -1025,7 +1026,7 @@ function Base.show(io::IO, results::ProfileResults)
header = [summary_column_names[name] for name in names(df)]
alignment = [name in ["name", "time_dist"] ? :l : :r for name in names(df)]
highlighters = time_highlighters(df)
pretty_table(io, df; header, alignment, formatters=summary_formatter(df), highlighters, crop)
pretty_table(io, df; column_labels=header, alignment, formatters=[summary_formatter(df)], highlighters=collect(highlighters), fit_table_in_display_horizontally=(crop==:horizontal), fit_table_in_display_vertically=false)
end
end

Expand Down