Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 349964
b: refs/heads/master
c: 2c803e5
h: refs/heads/master
v: v3
  • Loading branch information
David Ahern authored and Arnaldo Carvalho de Melo committed Jan 24, 2013
1 parent 7cb0b2c commit 2440b2e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 27 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: b7c14a0b6a4e3add92e1527a31cb1826f4799248
refs/heads/master: 2c803e5248d038988ec7c52e8fd7c83130dd3c13
22 changes: 0 additions & 22 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,28 +68,6 @@
#include <linux/unistd.h>
#include <linux/types.h>

void get_term_dimensions(struct winsize *ws)
{
char *s = getenv("LINES");

if (s != NULL) {
ws->ws_row = atoi(s);
s = getenv("COLUMNS");
if (s != NULL) {
ws->ws_col = atoi(s);
if (ws->ws_row && ws->ws_col)
return;
}
}
#ifdef TIOCGWINSZ
if (ioctl(1, TIOCGWINSZ, ws) == 0 &&
ws->ws_row && ws->ws_col)
return;
#endif
ws->ws_row = 25;
ws->ws_col = 80;
}

static void perf_top__update_print_entries(struct perf_top *top)
{
if (top->print_entries > 9)
Expand Down
4 changes: 0 additions & 4 deletions trunk/tools/perf/perf.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef _PERF_PERF_H
#define _PERF_PERF_H

struct winsize;

void get_term_dimensions(struct winsize *ws);

#include <asm/unistd.h>

#if defined(__i386__)
Expand Down
22 changes: 22 additions & 0 deletions trunk/tools/perf/util/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -220,3 +220,25 @@ void dump_stack(void)
#else
void dump_stack(void) {}
#endif

void get_term_dimensions(struct winsize *ws)
{
char *s = getenv("LINES");

if (s != NULL) {
ws->ws_row = atoi(s);
s = getenv("COLUMNS");
if (s != NULL) {
ws->ws_col = atoi(s);
if (ws->ws_row && ws->ws_col)
return;
}
}
#ifdef TIOCGWINSZ
if (ioctl(1, TIOCGWINSZ, ws) == 0 &&
ws->ws_row && ws->ws_col)
return;
#endif
ws->ws_row = 25;
ws->ws_col = 80;
}
3 changes: 3 additions & 0 deletions trunk/tools/perf/util/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,7 @@ void dump_stack(void);

extern unsigned int page_size;

struct winsize;
void get_term_dimensions(struct winsize *ws);

#endif

0 comments on commit 2440b2e

Please sign in to comment.