mm_hooks.rar

  • PUDN用户
    了解作者
  • Unix_Linux
    开发工具
  • 8KB
    文件大小
  • rar
    文件格式
  • 0
    收藏次数
  • 1 积分
    下载积分
  • 1
    下载次数
  • 2015-04-28 12:38
    上传日期
Define generic no-op hooks for arch_dup_mmap, arch_exit_mmap and arch_unmap to be included in asm-FOO mmu_context.h for any arch FOO which doesn t need to hook these.
mm_hooks.rar
  • mm_hooks.c
    668B
  • builtin-report.c
    24.4KB
内容介绍
/* * builtin-report.c * * Builtin report command: Analyze the perf.data input file, * look up and read DSOs and symbol information and display * a histogram of results, along various sorting keys. */ #include "builtin.h" #include "util/util.h" #include "util/cache.h" #include "util/annotate.h" #include "util/color.h" #include <linux/list.h> #include <linux/rbtree.h> #include "util/symbol.h" #include "util/callchain.h" #include "util/strlist.h" #include "util/values.h" #include "perf.h" #include "util/debug.h" #include "util/evlist.h" #include "util/evsel.h" #include "util/header.h" #include "util/session.h" #include "util/tool.h" #include "util/parse-options.h" #include "util/parse-events.h" #include "util/thread.h" #include "util/sort.h" #include "util/hist.h" #include "util/data.h" #include "arch/common.h" #include <dlfcn.h> #include <linux/bitmap.h> struct report { struct perf_tool tool; struct perf_session *session; bool force, use_tui, use_gtk, use_stdio; bool hide_unresolved; bool dont_use_callchains; bool show_full_info; bool show_threads; bool inverted_callchain; bool mem_mode; bool header; bool header_only; int max_stack; struct perf_read_values show_threads_values; const char *pretty_printing_style; const char *cpu_list; const char *symbol_filter_str; float min_percent; u64 nr_entries; u64 queue_size; DECLARE_BITMAP(cpu_bitmap, MAX_NR_CPUS); }; static int report__config(const char *var, const char *value, void *cb) { struct report *rep = cb; if (!strcmp(var, "report.group")) { symbol_conf.event_group = perf_config_bool(var, value); return 0; } if (!strcmp(var, "report.percent-limit")) { rep->min_percent = strtof(value, NULL); return 0; } if (!strcmp(var, "report.children")) { symbol_conf.cumulate_callchain = perf_config_bool(var, value); return 0; } if (!strcmp(var, "report.queue-size")) { rep->queue_size = perf_config_u64(var, value); return 0; } return perf_default_config(var, value, cb); } static void report__inc_stats(struct report *rep, struct hist_entry *he) { /* * The @he is either of a newly created one or an existing one * merging current sample. We only want to count a new one so * checking ->nr_events being 1. */ if (he->stat.nr_events == 1) rep->nr_entries++; } static int hist_iter__report_callback(struct hist_entry_iter *iter, struct addr_location *al, bool single, void *arg) { int err = 0; struct report *rep = arg; struct hist_entry *he = iter->he; struct perf_evsel *evsel = iter->evsel; struct mem_info *mi; struct branch_info *bi; report__inc_stats(rep, he); if (!ui__has_annotation()) return 0; if (sort__mode == SORT_MODE__BRANCH) { bi = he->branch_info; err = addr_map_symbol__inc_samples(&bi->from, evsel->idx); if (err) goto out; err = addr_map_symbol__inc_samples(&bi->to, evsel->idx); } else if (rep->mem_mode) { mi = he->mem_info; err = addr_map_symbol__inc_samples(&mi->daddr, evsel->idx); if (err) goto out; err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); } else if (symbol_conf.cumulate_callchain) { if (single) err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); } else { err = hist_entry__inc_addr_samples(he, evsel->idx, al->addr); } out: return err; } static int process_sample_event(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample, struct perf_evsel *evsel, struct machine *machine) { struct report *rep = container_of(tool, struct report, tool); struct addr_location al; struct hist_entry_iter iter = { .hide_unresolved = rep->hide_unresolved, .add_entry_cb = hist_iter__report_callback, }; int ret; if (perf_event__preprocess_sample(event, machine, &al, sample) < 0) { pr_debug("problem processing %d event, skipping it.\n", event->header.type); return -1; } if (rep->hide_unresolved && al.sym == NULL) return 0; if (rep->cpu_list && !test_bit(sample->cpu, rep->cpu_bitmap)) return 0; if (sort__mode == SORT_MODE__BRANCH) iter.ops = &hist_iter_branch; else if (rep->mem_mode) iter.ops = &hist_iter_mem; else if (symbol_conf.cumulate_callchain) iter.ops = &hist_iter_cumulative; else iter.ops = &hist_iter_normal; if (al.map != NULL) al.map->dso->hit = 1; ret = hist_entry_iter__add(&iter, &al, evsel, sample, rep->max_stack, rep); if (ret < 0) pr_debug("problem adding hist entry, skipping event\n"); return ret; } static int process_read_event(struct perf_tool *tool, union perf_event *event, struct perf_sample *sample __maybe_unused, struct perf_evsel *evsel, struct machine *machine __maybe_unused) { struct report *rep = container_of(tool, struct report, tool); if (rep->show_threads) { const char *name = evsel ? perf_evsel__name(evsel) : "unknown"; perf_read_values_add_value(&rep->show_threads_values, event->read.pid, event->read.tid, event->read.id, name, event->read.value); } dump_printf(": %d %d %s %" PRIu64 "\n", event->read.pid, event->read.tid, evsel ? perf_evsel__name(evsel) : "FAIL", event->read.value); return 0; } /* For pipe mode, sample_type is not currently set */ static int report__setup_sample_type(struct report *rep) { struct perf_session *session = rep->session; u64 sample_type = perf_evlist__combined_sample_type(session->evlist); bool is_pipe = perf_data_file__is_pipe(session->file); if (!is_pipe && !(sample_type & PERF_SAMPLE_CALLCHAIN)) { if (sort__has_parent) { ui__error("Selected --sort parent, but no " "callchain data. Did you call " "'perf record' without -g?\n"); return -EINVAL; } if (symbol_conf.use_callchain) { ui__error("Selected -g or --branch-history but no " "callchain data. Did\n" "you call 'perf record' without -g?\n"); return -1; } } else if (!rep->dont_use_callchains && callchain_param.mode != CHAIN_NONE && !symbol_conf.use_callchain) { symbol_conf.use_callchain = true; if (callchain_register_param(&callchain_param) < 0) { ui__error("Can't register callchain params.\n"); return -EINVAL; } } if (symbol_conf.cumulate_callchain) { /* Silently ignore if callchain is missing */ if (!(sample_type & PERF_SAMPLE_CALLCHAIN)) { symbol_conf.cumulate_callchain = false; perf_hpp__cancel_cumulate(); } } if (sort__mode == SORT_MODE__BRANCH) { if (!is_pipe && !(sample_type & PERF_SAMPLE_BRANCH_STACK)) { ui__error("Selected -b but no branch data. " "Did you call perf record without -b?\n"); return -1; } } if (symbol_conf.use_callchain || symbol_conf.cumulate_callchain) { if ((sample_type & PERF_SAMPLE_REGS_USER) && (sample_type & PERF_SAMPLE_STACK_USER)) callchain_param.record_mode = CALLCHAIN_DWARF; else callchain_param.record_mode = CALLCHAIN_FP; } return 0; } static void sig_handler(int sig __maybe_unused) { session_done = 1; } static size_t hists__fprintf_nr_sample_events(struct hists *hists, struct report *rep, const char *evname, FILE *fp) { size_t ret; char unit; unsigned long nr_samples = hists->stats.nr_events[PERF_RECORD_SAMPLE]; u64 nr_events = hists->stats.total_period; struct perf_evsel *evsel = hists_to_evsel(hists); char buf[512]; size_t size = sizeof(buf); if (symbol_conf.filter_relative) { nr_samples = hists->stats.nr_non_filtered_samples; nr_events = hists->stats.total_non_filtered_period; } if (perf_evsel__is_group_event(evsel)) { struct perf_evsel *pos; perf_evsel__group_desc(evsel, buf, size); evname = buf; for_each_group_member(pos, evsel) { const struct hists *pos_hists = evsel__hists(pos); if (symbol_conf.filter_relative) { nr_samples += pos_hists->stats.nr_non_filtered_samples; nr_events += pos_hists->stats.total_non_filtered_period; } else { nr_samples += pos_hists->stats.nr_events[PERF_RECORD_
评论
    相关推荐
    • nonbinary_EXIT.rar
      详细说明LDPC码非二进制下的EXIT特性分析的matlab代码
    • draw.rar
      printf["No such mode\n"] exit[1] } //取得信息 width = vga_getxdim[] height = vga_getydim[] colors = vga_getcolors[] //绘图 for[i=0 i<colors i++]{ vga_setcolor...
    • NO.1.rar
      linux下驱动学习基础源码,这里主要是字符驱动与驱动一些相关的源码,包括模块使用、驱动符号到处使用等
    • ctable.zip
      Your account had not activated, please Upload source codes/documents t
    • nommu.rar
      nommu.c: mmu-less memory info files.
    • heroku-exit-status:扩展heroku客户端以返回真实的退出状态
      $ heroku plugins:install https://github.com/glenngillen/heroku-exit-status.git 用法 heroku run使用heroku run $ heroku run ls Running `ls` attached to terminal... up, run.1 app bin config config.ru ...
    • No20-37.rar
      学生信息管理系统的主要任务是对学生成绩档案进行整理,使得人们能方便快捷地对学生成绩档案进行统计、查询、修改、删除,并能根据要求打印出学生的成绩来。 通过该系统,使得学校的学生成绩管理工作更加系统化,...
    • no_pg_ds_v3
      Disable PatchGuard/Driver Signing, v3 - update on 21/01/2012 changes: winload.exe -- ImgpValidateImageHash patch to return ... -->> No UAC, no 'run as Administrator', or other such non-sense... <<--
    • EXIT chart 最全代码算法及资料
      EXIT chart 最全代码算法及资料,超全的matlab代码!直接下载便可以使用~
    • Z_FIND_USEREXIT.rar
      通过SAP事物代码查询相关增强,并展示的程序。