linux/tools/perf/util/thread.h
<<
>>
Prefs
   1#ifndef __PERF_THREAD_H
   2#define __PERF_THREAD_H
   3
   4#include <linux/rbtree.h>
   5#include <unistd.h>
   6#include "symbol.h"
   7
   8struct map_groups {
   9        struct rb_root          maps[MAP__NR_TYPES];
  10        struct list_head        removed_maps[MAP__NR_TYPES];
  11};
  12
  13struct thread {
  14        struct rb_node          rb_node;
  15        struct map_groups       mg;
  16        pid_t                   pid;
  17        char                    shortname[3];
  18        char                    *comm;
  19        int                     comm_len;
  20};
  21
  22void map_groups__init(struct map_groups *self);
  23int thread__set_comm(struct thread *self, const char *comm);
  24int thread__comm_len(struct thread *self);
  25struct thread *perf_session__findnew(struct perf_session *self, pid_t pid);
  26void thread__insert_map(struct thread *self, struct map *map);
  27int thread__fork(struct thread *self, struct thread *parent);
  28size_t map_groups__fprintf_maps(struct map_groups *self, FILE *fp);
  29size_t perf_session__fprintf(struct perf_session *self, FILE *fp);
  30
  31void maps__insert(struct rb_root *maps, struct map *map);
  32struct map *maps__find(struct rb_root *maps, u64 addr);
  33
  34static inline void map_groups__insert(struct map_groups *self, struct map *map)
  35{
  36         maps__insert(&self->maps[map->type], map);
  37}
  38
  39static inline struct map *map_groups__find(struct map_groups *self,
  40                                           enum map_type type, u64 addr)
  41{
  42        return maps__find(&self->maps[type], addr);
  43}
  44
  45static inline struct map *thread__find_map(struct thread *self,
  46                                           enum map_type type, u64 addr)
  47{
  48        return self ? map_groups__find(&self->mg, type, addr) : NULL;
  49}
  50
  51void thread__find_addr_location(struct thread *self,
  52                                struct perf_session *session, u8 cpumode,
  53                                enum map_type type, u64 addr,
  54                                struct addr_location *al,
  55                                symbol_filter_t filter);
  56struct symbol *map_groups__find_symbol(struct map_groups *self,
  57                                       struct perf_session *session,
  58                                       enum map_type type, u64 addr,
  59                                       symbol_filter_t filter);
  60
  61static inline struct symbol *
  62map_groups__find_function(struct map_groups *self, struct perf_session *session,
  63                          u64 addr, symbol_filter_t filter)
  64{
  65        return map_groups__find_symbol(self, session, MAP__FUNCTION, addr, filter);
  66}
  67
  68struct map *map_groups__find_by_name(struct map_groups *self,
  69                                     enum map_type type, const char *name);
  70#endif  /* __PERF_THREAD_H */
  71
lxr.linux.no kindly hosted by Redpill Linpro AS, provider of Linux consulting and operations services since 1995.