Merge branch 'perf/core' of git://git.kernel.org/pub/scm/linux/kernel/git/frederic...
authorIngo Molnar <mingo@elte.hu>
Mon, 3 May 2010 06:29:35 +0000 (08:29 +0200)
committerIngo Molnar <mingo@elte.hu>
Mon, 3 May 2010 06:29:35 +0000 (08:29 +0200)
1  2 
tools/perf/util/trace-event-read.c
tools/perf/util/trace-event.h

@@@ -51,8 -51,13 +51,14 @@@ static int long_size
  static unsigned long  page_size;
  
  static ssize_t calc_data_size;
 +static bool repipe;
  
+ /* If it fails, the next read will report it */
+ static void skip(int size)
+ {
+       lseek(input_fd, size, SEEK_CUR);
+ }
  static int do_read(int fd, void *buf, int size)
  {
        int rsize = size;
                if (ret <= 0)
                        return -1;
  
 +              if (repipe) {
 +                      int retw = write(STDOUT_FILENO, buf, ret);
 +
 +                      if (retw <= 0 || retw != ret)
 +                              die("repiping input file");
 +              }
 +
                size -= ret;
                buf += ret;
        }
@@@ -124,13 -122,6 +130,13 @@@ static char *read_string(void
                if (!r)
                        die("no data");
  
 +              if (repipe) {
 +                      int retw = write(STDOUT_FILENO, &c, 1);
 +
 +                      if (retw <= 0 || retw != r)
 +                              die("repiping input file string");
 +              }
 +
                buf[size++] = c;
  
                if (!c)
@@@ -184,7 -175,6 +190,6 @@@ static void read_ftrace_printk(void
  static void read_header_files(void)
  {
        unsigned long long size;
-       char *header_page;
        char *header_event;
        char buf[BUFSIZ];
  
                die("did not read header page");
  
        size = read8();
-       header_page = malloc_or_die(size);
-       read_or_die(header_page, size);
-       parse_header_page(header_page, size);
-       free(header_page);
+       skip(size);
  
        /*
         * The size field in the page is of type long,
@@@ -469,7 -456,7 +471,7 @@@ struct record *trace_read_data(int cpu
        return data;
  }
  
 -ssize_t trace_report(int fd)
 +ssize_t trace_report(int fd, bool __repipe)
  {
        char buf[BUFSIZ];
        char test[] = { 23, 8, 68 };
        ssize_t size;
  
        calc_data_size = 1;
 +      repipe = __repipe;
  
        input_fd = fd;
  
  
        size = calc_data_size - 1;
        calc_data_size = 0;
 +      repipe = false;
  
        if (show_funcs) {
                print_funcs();
@@@ -163,7 -163,7 +163,7 @@@ struct record *trace_read_data(int cpu)
  
  void parse_set_info(int nr_cpus, int long_sz);
  
 -ssize_t trace_report(int fd);
 +ssize_t trace_report(int fd, bool repipe);
  
  void *malloc_or_die(unsigned int size);
  
@@@ -244,7 -244,6 +244,6 @@@ extern int header_page_data_size
  
  extern bool latency_format;
  
- int parse_header_page(char *buf, unsigned long size);
  int trace_parse_common_type(void *data);
  int trace_parse_common_pid(void *data);
  int parse_common_pc(void *data);