Permalink
Browse files

Better warning and error reporting for small or invalid profiles. Fixes

  • Loading branch information...
ccurtsinger committed Oct 19, 2018
1 parent d9de1a1 commit be457aa3463e08a1160b7200c21eb11a00ec6c74
Showing with 82 additions and 9 deletions.
  1. +14 −1 viewer/index.htm
  2. +5 −0 viewer/plot.css
  3. +21 −1 viewer/profile.js
  4. +1 −1 viewer/profile.js.map
  5. +24 −3 viewer/profile.ts
  6. +7 −1 viewer/ui.js
  7. +1 −1 viewer/ui.js.map
  8. +9 −1 viewer/ui.ts
@@ -57,7 +57,20 @@ <h4 id="minpoints_label">Minimum Points</h4>
<div id="warning-area" class="col-md-12"></div>
</div>
<div class="row">
<div id="plot-area" class="col-md-12"></div>
<div id="plot-area" class="col-md-12">
<div id="plot-message">
<h1>Getting Started</h1>
<p>
Welcome to the causal profile viewer. To make use of this profile viewer you'll first need a causal profile. You will need to use the <code>coz</code> program to collect a causal profile from your program. For this to work, you will need to add at least one <i>progress point</i> to your program, and then build it with debug information. Next, run your program with <code>coz</code>:
</p>
<pre>
$ coz run --- ./myprogram arg1 arg2
</pre>
<p>
Next, you will need to load your profile into this viewer. Click the <kbd>Load Profile</kbd> button on this page and browse to your file. There are some sample profiles available as well if you want to see what a causal profile looks like.
</p>
</div>
</div>
</div>
</div> <!-- /main content -->
@@ -15,6 +15,11 @@ div.plot-title {
z-index: 0;
}
div.plot-message {
color: #EEE;
}
.xaxis path,
.xaxis line,
.yaxis path,

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -30,7 +30,7 @@ interface LatencyData {
duration: number;
}
type Line = Experiment | ThroughputPoint | LatencyPoint;
type Line = Experiment | ThroughputPoint | LatencyPoint | IgnoredRecord;
interface Experiment {
type: 'experiment';
@@ -53,6 +53,10 @@ interface LatencyPoint {
difference: number;
}
interface IgnoredRecord {
type: 'startup' | 'shutdown' | 'samples' | 'runtime';
}
/**
* Returns if this data point is valid.
* Infinity / -Infinity occurs when dividing by 0.
@@ -217,14 +221,28 @@ class Profile {
if (lines[i].length == 0) continue;
let entry = parseLine(lines[i]);
if (entry.type === 'experiment') {
if (entry.type === 'startup') {
// Do nothing
} else if (entry.type === 'shutdown') {
// Do nothing
} else if (entry.type === 'samples') {
// Do nothing
} else if (entry.type === 'runtime') {
// Do nothing
} else if (entry.type === 'experiment') {
experiment = entry;
} else if (entry.type === 'throughput-point' || entry.type === 'progress-point') {
this.addThroughputMeasurement(experiment, entry);
} else if (entry.type === 'latency-point') {
this.addLatencyMeasurement(experiment, entry);
} else {
display_warning('Invalid Profile', 'The profile you loaded contains an invalid line: <pre>' + lines[i] + '</pre>');
}
}
if (experiment == null) {
display_warning('Empty Profile', 'The profile you loaded does not contain result from any performance experiments. Make sure you specified a progress point, built your program with debug information, and ran your program on an input that took at least a few seconds.')
}
}
public ensureDataEntry<T extends ExperimentData>(selected: string, point: string, speedup: number, initial_value: T): T {
@@ -396,7 +414,7 @@ class Profile {
legend_entries_sel.exit().remove();
}
public drawPlots(no_animate: boolean): void {
public drawPlots(no_animate: boolean): number {
const container = this._plot_container;
const min_points = this._get_min_points();
const speedup_data = this.getSpeedupData(min_points);
@@ -682,5 +700,8 @@ class Profile {
tip.hide(d, i);
});
points_sel.exit().remove();
// Return the number of plots
return speedup_data.length;
}
}

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -32,7 +32,15 @@ function update(resize?: boolean) {
d3.select('#sortby_field').attr('disabled', null);
// Draw plots
current_profile.drawPlots(resize);
let num_plots = current_profile.drawPlots(resize);
// Clear the message area
d3.select('#plot-message').text('');
// Display a warning if there are no plots
if (num_plots == 0) {
d3.select('#plot-message').html('<h1>No Data to Plot</h1><p>Your profile does not contain enough observations to generate any plots. Try reducing the minimum number of points required to show a plot using the slider, or run your program for a longer time to collect more data.</p>');
}
// Draw the legend
current_profile.drawLegend();

0 comments on commit be457aa

Please sign in to comment.