opd_anon.c File Reference

#include "opd_anon.h"
#include "opd_trans.h"
#include "opd_sfile.h"
#include "opd_printf.h"
#include "op_libiberty.h"
#include <limits.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
Include dependency graph for opd_anon.c:

Go to the source code of this file.

Defines

#define HASH_SIZE   1024
#define HASH_BITS   (HASH_SIZE - 1)
#define LRU_SIZE   8192
#define LRU_AMOUNT   (LRU_SIZE/8)

Functions

static void do_lru (struct transient *trans)
static unsigned long hash_anon (pid_t tgid, cookie_t app)
static void clear_anon_maps (struct transient *trans)
static void add_anon_mapping (struct transient *trans, vma_t start, vma_t end, char *name)
static void get_anon_maps (struct transient *trans)
static int anon_match (struct transient const *trans, struct anon_mapping const *anon)
struct anon_mappingfind_anon_mapping (struct transient *trans)
void anon_init (void)

Variables

static struct list_head hashes [HASH_SIZE]
static struct list_head lru
static size_t nr_lru

Detailed Description

Anonymous region handling.

Our caching of maps has some problems: if we get tgid reuse, and it's the same application, we might end up with wrong maps. The same happens in an unmap-remap case. There's not much we can do about this, we just hope it's not too common...

What is relatively common is expanding anon maps, which leaves us with lots of separate sample files.

Remarks:
Copyright 2005 OProfile authors
Read the file COPYING
Author:
John Levon Gisle Dankel

Definition in file opd_anon.c.


Define Documentation

#define HASH_BITS   (HASH_SIZE - 1)

Definition at line 32 of file opd_anon.c.

Referenced by sfile_find(), and sfile_hash().

#define HASH_SIZE   1024

Definition at line 31 of file opd_anon.c.

Referenced by anon_init(), cookie_init(), hash_anon(), hash_cookie(), operf_sfile_init(), and sfile_init().

#define LRU_AMOUNT   (LRU_SIZE/8)

Definition at line 41 of file opd_anon.c.

#define LRU_SIZE   8192

Definition at line 40 of file opd_anon.c.

Referenced by add_anon_mapping().


Function Documentation

static void add_anon_mapping ( struct transient trans,
vma_t  start,
vma_t  end,
char *  name 
) [static]
void anon_init ( void   ) 

Definition at line 220 of file opd_anon.c.

References HASH_SIZE, hashes, list_init(), and lru.

Referenced by opd_26_init().

Here is the call graph for this function:

Here is the caller graph for this function:

static int anon_match ( struct transient const *  trans,
struct anon_mapping const *  anon 
) [static]

Definition at line 165 of file opd_anon.c.

References anon_mapping::app_cookie, anon_mapping::end, operf_transient::pc, anon_mapping::start, anon_mapping::tgid, operf_transient::tgid, and trans.

Referenced by find_anon_mapping().

Here is the caller graph for this function:

static void clear_anon_maps ( struct transient trans  )  [static]
static void do_lru ( struct transient trans  )  [static]

Definition at line 47 of file opd_anon.c.

References clear_trans_current(), clear_trans_last(), anon_mapping::list, list_del(), list_entry, list_for_each_safe, lru, LRU_AMOUNT, anon_mapping::lru_list, nr_lru, sfile_clear_anon(), and trans.

Referenced by add_anon_mapping().

Here is the call graph for this function:

Here is the caller graph for this function:

struct anon_mapping* find_anon_mapping ( struct transient  )  [read]

Try to find an anonymous mapping for the given pc/tgid pair.

Definition at line 179 of file opd_anon.c.

References anon_match(), clear_anon_maps(), anon_mapping::end, get_anon_maps(), hash_anon(), hashes, anon_mapping::list, list_add(), list_del(), list_entry, list_for_each, operf_transient::pc, anon_mapping::start, anon_mapping::tgid, operf_transient::tgid, trans, verbprintf, and vmisc.

Referenced by opd_put_ibs_sample(), and opd_put_sample().

Here is the call graph for this function:

Here is the caller graph for this function:

static void get_anon_maps ( struct transient trans  )  [static]

Definition at line 131 of file opd_anon.c.

References add_anon_mapping(), buf, anon_mapping::end, MAX_IMAGE_NAME_SIZE, anon_mapping::name, anon_mapping::start, operf_transient::tgid, and trans.

Referenced by find_anon_mapping().

Here is the call graph for this function:

Here is the caller graph for this function:

static unsigned long hash_anon ( pid_t  tgid,
cookie_t  app 
) [static]

Definition at line 71 of file opd_anon.c.

References DCOOKIE_SHIFT, and HASH_SIZE.

Referenced by add_anon_mapping(), clear_anon_maps(), and find_anon_mapping().

Here is the caller graph for this function:


Variable Documentation

struct list_head hashes[HASH_SIZE] [static]

Definition at line 43 of file opd_anon.c.

Referenced by add_anon_mapping(), anon_init(), clear_anon_maps(), and find_anon_mapping().

struct list_head lru [static]
size_t nr_lru [static]

Definition at line 45 of file opd_anon.c.

Referenced by add_anon_mapping(), clear_anon_maps(), and do_lru().


Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1