コード例 #1
0
int event__preprocess_sample(const event_t *self, struct perf_session *session,
                             struct addr_location *al, symbol_filter_t filter)
{
    u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
    struct thread *thread = perf_session__findnew(session, self->ip.pid);

    if (thread == NULL)
        return -1;

    if (symbol_conf.comm_list &&
            !strlist__has_entry(symbol_conf.comm_list, thread->comm))
        goto out_filtered;

    dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);

    thread__find_addr_location(thread, session, cpumode, MAP__FUNCTION,
                               self->ip.ip, al, filter);
    dump_printf(" ...... dso: %s\n",
                al->map ? al->map->dso->long_name :
                al->level == 'H' ? "[hypervisor]" : "<not found>");
    /*
     * We have to do this here as we may have a dso with no symbol hit that
     * has a name longer than the ones with symbols sampled.
     */
    if (al->map && !sort_dso.elide && !al->map->dso->slen_calculated)
        dso__calc_col_width(al->map->dso);

    if (symbol_conf.dso_list &&
            (!al->map || !al->map->dso ||
             !(strlist__has_entry(symbol_conf.dso_list, al->map->dso->short_name) ||
               (al->map->dso->short_name != al->map->dso->long_name &&
                strlist__has_entry(symbol_conf.dso_list, al->map->dso->long_name)))))
        goto out_filtered;

    if (symbol_conf.sym_list && al->sym &&
            !strlist__has_entry(symbol_conf.sym_list, al->sym->name))
        goto out_filtered;

    al->filtered = false;
    return 0;

out_filtered:
    al->filtered = true;
    return 0;
}
コード例 #2
0
int event__preprocess_sample(const event_t *self, struct perf_session *session,
			     struct addr_location *al, symbol_filter_t filter)
{
	u8 cpumode = self->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
	struct thread *thread = perf_session__findnew(session, self->ip.pid);

	if (thread == NULL)
		return -1;

	if (symbol_conf.comm_list &&
	    !strlist__has_entry(symbol_conf.comm_list, thread->comm))
		goto out_filtered;

	dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
	/*
	 * Have we already created the kernel maps for the host machine?
	 *
	 * This should have happened earlier, when we processed the kernel MMAP
	 * events, but for older perf.data files there was no such thing, so do
	 * it now.
	 */
	if (cpumode == PERF_RECORD_MISC_KERNEL &&
	    session->host_machine.vmlinux_maps[MAP__FUNCTION] == NULL)
		machine__create_kernel_maps(&session->host_machine);

	thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
			      self->ip.pid, self->ip.ip, al);
	dump_printf(" ...... dso: %s\n",
		    al->map ? al->map->dso->long_name :
			al->level == 'H' ? "[hypervisor]" : "<not found>");
	al->sym = NULL;

	if (al->map) {
		if (symbol_conf.dso_list &&
		    (!al->map || !al->map->dso ||
		     !(strlist__has_entry(symbol_conf.dso_list,
					  al->map->dso->short_name) ||
		       (al->map->dso->short_name != al->map->dso->long_name &&
			strlist__has_entry(symbol_conf.dso_list,
					   al->map->dso->long_name)))))
			goto out_filtered;
		/*
		 * We have to do this here as we may have a dso with no symbol
		 * hit that has a name longer than the ones with symbols
		 * sampled.
		 */
		if (!sort_dso.elide && !al->map->dso->slen_calculated)
			dso__calc_col_width(al->map->dso);

		al->sym = map__find_symbol(al->map, al->addr, filter);
	} else {
		const unsigned int unresolved_col_width = BITS_PER_LONG / 4;

		if (dsos__col_width < unresolved_col_width &&
		    !symbol_conf.col_width_list_str && !symbol_conf.field_sep &&
		    !symbol_conf.dso_list)
			dsos__col_width = unresolved_col_width;
	}

	if (symbol_conf.sym_list && al->sym &&
	    !strlist__has_entry(symbol_conf.sym_list, al->sym->name))
		goto out_filtered;

	return 0;

out_filtered:
	al->filtered = true;
	return 0;
}