Declare bin_parser_free();

2006-11-19   Soren Sandmann <sandmann@redhat.com>

        * binparser.h: Declare bin_parser_free();

        * elfparser.c (elf_parser_get_crc32): Use madvise(DONT_NEED) on
        the file.

        * process.c (struct Process): Remove do_offset.
This commit is contained in:
Soren Sandmann
2006-11-19 22:48:28 +00:00
committed by Søren Sandmann Pedersen
parent 66fc976342
commit 9af533a11f
6 changed files with 34 additions and 7 deletions

View File

@ -1,3 +1,12 @@
2006-11-19 Soren Sandmann <sandmann@redhat.com>
* binparser.h: Declare bin_parser_free();
* elfparser.c (elf_parser_get_crc32): Use madvise(DONT_NEED) on
the file.
* process.c (struct Process): Remove do_offset.
Thu Nov 9 17:55:24 2006 Søren Sandmann <sandmann@redhat.com>
* TODO (-): udpate

11
TODO
View File

@ -203,7 +203,18 @@ Before 1.2:
- plug all the leaks
- loading and saving probably leak right now
- make it use less memory:
- StackNodes are dominating
- fold 'toplevel' into 'size'
- allocate in blocks
- this will need to be coordinated with
profile.c which also creates stacknodes.
- maybe simply make stackstashes able to
save themselves.
- rethink loading and saving. Goals
- Can load 1.0 profiles
- Don't export too much of stackstashes to the rest of the
app

View File

@ -8,6 +8,7 @@ typedef struct BinRecord BinRecord;
/* BinParser */
BinParser * bin_parser_new (const guchar *data,
gsize length);
void bin_parser_free (BinParser *parser);
const guchar *bin_parser_get_data (BinParser *parser);
gsize bin_parser_get_length (BinParser *parser);
gsize bin_parser_get_offset (BinParser *parser);

View File

@ -1,6 +1,7 @@
#include <stdlib.h>
#include <string.h>
#include <elf.h>
#include <sys/mman.h>
#include "binparser.h"
#include "elfparser.h"
@ -269,6 +270,14 @@ elf_parser_get_crc32 (ElfParser *parser)
for (i = 0; i < length; ++i)
crc = crc32_table[(crc ^ data[i]) & 0xff] ^ (crc >> 8);
/* We just read the entire file into memory, but we only really
* need the symbol table, so swap the whole thing out.
*
* We could be more exact here, but it's only a few minor
* pagefaults.
*/
madvise ((char *)data, length, MADV_DONTNEED);
return ~crc & 0xffffffff;
}

View File

@ -40,9 +40,6 @@ struct Map
gulong end;
gulong offset;
gulong inode;
#if 0
gboolean do_offset;
#endif
BinFile * bin_file;
};
@ -50,14 +47,14 @@ struct Map
struct Process
{
char * cmdline;
int n_maps;
Map * maps;
GList * bad_pages;
int pid;
const char *undefined;
};

View File

@ -1,3 +1,5 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- */
/* Sysprof -- Sampling, systemwide CPU profiler
* Copyright 2004, Red Hat, Inc.
* Copyright 2004, 2005, Soeren Sandmann
@ -17,8 +19,6 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- */
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>