#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>
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_mapping * | find_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 |
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.
Definition in file opd_anon.c.
#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().
static void add_anon_mapping | ( | struct transient * | trans, | |
vma_t | start, | |||
vma_t | end, | |||
char * | name | |||
) | [static] |
Definition at line 109 of file opd_anon.c.
References anon_mapping::app_cookie, do_lru(), anon_mapping::end, hash_anon(), hashes, anon_mapping::list, list_add_tail(), lru, anon_mapping::lru_list, LRU_SIZE, MAX_IMAGE_NAME_SIZE, anon_mapping::name, nr_lru, anon_mapping::start, anon_mapping::tgid, operf_transient::tgid, trans, verbose_cookie(), and vmisc.
Referenced by get_anon_maps().
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().
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().
static void clear_anon_maps | ( | struct transient * | trans | ) | [static] |
Definition at line 77 of file opd_anon.c.
References anon_mapping::app_cookie, clear_trans_current(), clear_trans_last(), hash_anon(), hashes, anon_mapping::list, list_del(), list_entry, list_for_each_safe, anon_mapping::lru_list, anon_mapping::name, nr_lru, sfile_clear_anon(), anon_mapping::tgid, operf_transient::tgid, trans, verbose_cookie(), and vmisc.
Referenced by find_anon_mapping().
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().
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().
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().
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().
Definition at line 43 of file opd_anon.c.
Referenced by add_anon_mapping(), anon_init(), clear_anon_maps(), and find_anon_mapping().
Definition at line 44 of file opd_anon.c.
Referenced by add_anon_mapping(), anon_init(), do_lru(), for_each_sfile(), operf_sfile_find(), operf_sfile_lru_clear(), sfile_find(), and sfile_lru_clear().
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().