Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164328
b: refs/heads/master
c: 5094b65
h: refs/heads/master
v: v3
  • Loading branch information
Arjan van de Ven authored and Ingo Molnar committed Sep 20, 2009
1 parent 0cf2368 commit b479b4c
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a92fe7b3063db2caa578872fce975ff53aa56214
refs/heads/master: 5094b655452dd48367fb28af74ffc76019b93dc2
3 changes: 3 additions & 0 deletions trunk/tools/perf/Documentation/perf-timechart.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ OPTIONS
-i::
--input=::
Select the input file (default: perf.data)
-w::
--width=::
Select the width of the SVG file (default: 1000)


SEE ALSO
Expand Down
6 changes: 4 additions & 2 deletions trunk/tools/perf/builtin-timechart.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,9 +915,9 @@ static void write_svg_file(const char *filename)
if (count < 15)
count = determine_display_tasks(TIME_THRESH / 10);

open_svg(filename, numcpus, count);
open_svg(filename, numcpus, count, first_time, last_time);

svg_time_grid(first_time, last_time);
svg_time_grid();
svg_legenda();

for (i = 0; i < numcpus; i++)
Expand Down Expand Up @@ -1132,6 +1132,8 @@ static const struct option options[] = {
"input file name"),
OPT_STRING('o', "output", &output_name, "file",
"output file name"),
OPT_INTEGER('w', "width", &svg_page_width,
"page width"),
OPT_END()
};

Expand Down
30 changes: 20 additions & 10 deletions trunk/tools/perf/util/svghelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ static u64 turbo_frequency, max_freq;

#define SLOT_MULT 30.0
#define SLOT_HEIGHT 25.0
#define WIDTH 1000.0

int svg_page_width = 1000;

#define MIN_TEXT_SIZE 0.001

Expand All @@ -46,21 +47,35 @@ static double time2pixels(u64 time)
{
double X;

X = WIDTH * (time - first_time) / (last_time - first_time);
X = 1.0 * svg_page_width * (time - first_time) / (last_time - first_time);
return X;
}

void open_svg(const char *filename, int cpus, int rows)
void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end)
{
int new_width;

svgfile = fopen(filename, "w");
if (!svgfile) {
fprintf(stderr, "Cannot open %s for output\n", filename);
return;
}
first_time = start;
first_time = first_time / 100000000 * 100000000;
last_time = end;

/*
* if the recording is short, we default to a width of 1000, but
* for longer recordings we want at least 200 units of width per second
*/
new_width = (last_time - first_time) / 5000000;

if (new_width > svg_page_width)
svg_page_width = new_width;

total_height = (1 + rows + cpu2slot(cpus)) * SLOT_MULT;
fprintf(svgfile, "<?xml version=\"1.0\" standalone=\"no\"?> \n");
fprintf(svgfile, "<svg width=\"%4.1f\" height=\"%llu\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", WIDTH, total_height);
fprintf(svgfile, "<svg width=\"%i\" height=\"%llu\" version=\"1.1\" xmlns=\"http://www.w3.org/2000/svg\">\n", svg_page_width, total_height);

fprintf(svgfile, "<defs>\n <style type=\"text/css\">\n <![CDATA[\n");

Expand Down Expand Up @@ -404,15 +419,10 @@ void svg_legenda(void)
svg_legenda_box(800, "Blocked on IO", "blocked");
}

void svg_time_grid(u64 start, u64 end)
void svg_time_grid(void)
{
u64 i;

first_time = start;
last_time = end;

first_time = first_time / 100000000 * 100000000;

if (!svgfile)
return;

Expand Down
6 changes: 4 additions & 2 deletions trunk/tools/perf/util/svghelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include "types.h"

extern void open_svg(const char *filename, int cpus, int rows);
extern void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end);
extern void svg_box(int Yslot, u64 start, u64 end, const char *type);
extern void svg_sample(int Yslot, int cpu, u64 start, u64 end);
extern void svg_waiting(int Yslot, u64 start, u64 end);
Expand All @@ -15,12 +15,14 @@ extern void svg_cstate(int cpu, u64 start, u64 end, int type);
extern void svg_pstate(int cpu, u64 start, u64 end, u64 freq);


extern void svg_time_grid(u64 start, u64 end);
extern void svg_time_grid(void);
extern void svg_legenda(void);
extern void svg_wakeline(u64 start, int row1, int row2);
extern void svg_partial_wakeline(u64 start, int row1, char *desc1, int row2, char *desc2);
extern void svg_interrupt(u64 start, int row);
extern void svg_text(int Yslot, u64 start, const char *text);
extern void svg_close(void);

extern int svg_page_width;

#endif

0 comments on commit b479b4c

Please sign in to comment.