perf tools: Introduce perf_session class

That does all the initialization boilerplate, opening the file,
reading the header, checking if it is valid, etc.

And that will as well have the threads list, kmap (now) global
variable, etc, so that we can handle two (or more) perf.data files
describing sessions to compare.

Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Frédéric Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
LKML-Reference: <1260573842-19720-1-git-send-email-acme@infradead.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
Arnaldo Carvalho de Melo
2009-12-11 21:24:02 -02:00
committed by Ingo Molnar
parent ea08d8cbd1
commit 94c744b6c0
15 changed files with 206 additions and 181 deletions

16
tools/perf/util/session.h Normal file
View File

@ -0,0 +1,16 @@
#ifndef __PERF_SESSION_H
#define __PERF_SESSION_H
#include "header.h"
struct perf_session {
struct perf_header header;
unsigned long size;
int fd;
char filename[0];
};
struct perf_session *perf_session__new(const char *filename, int mode, bool force);
void perf_session__delete(struct perf_session *self);
#endif /* __PERF_SESSION_H */