/* * Find a matching entry and/or link current entry to RB tree. * Either one of the dso or name parameter must be non-NULL or the * function will not work.
*/ staticstruct dso *__dsos__find_by_longname_id(struct dsos *dsos, constchar *name, conststruct dso_id *id, bool write_locked)
SHARED_LOCKS_REQUIRED(dsos->lock)
{ struct dsos__key key = {
.long_name = name,
.id = id,
}; struct dso **res;
if (dsos->dsos == NULL) return NULL;
if (!dsos->sorted) { if (!write_locked) { struct dso *dso;
staticvoid dso__set_basename(struct dso *dso)
{ char *base, *lname; int tid;
if (perf_pid_map_tid(dso__long_name(dso), &tid)) { if (asprintf(&base, "[JIT] tid %d", tid) < 0) return;
} else { /* * basename() may modify path buffer, so we must pass * a copy.
*/
lname = strdup(dso__long_name(dso)); if (!lname) return;
/* * basename() may return a pointer to internal * storage which is reused in subsequent calls * so copy the result.
*/
base = strdup(basename(lname));
free(lname);
if (!base) return;
}
dso__set_short_name(dso, base, true);
}
if (dso != NULL) { /* * The dsos lock is held on entry, so rename the dso before * adding it to avoid needing to take the dsos lock again to say * the array isn't sorted.
*/
dso__set_basename(dso);
__dsos__add(dsos, dso);
} return dso;
}
dso = __dsos__find_id(dsos, m->name, &dso_id_empty, /*cmp_short=*/true, /*write_locked=*/true); if (dso) {
up_write(&dsos->lock); return dso;
} /* * Failed to find the dso so create it. Change the name before adding it * to the array, to avoid unnecessary sorts and potential locking * issues.
*/
dso = dso__new_id(m->name, /*id=*/NULL); if (!dso) {
up_write(&dsos->lock); return NULL;
}
dso__set_basename(dso);
dso__set_module_info(dso, m, machine);
dso__set_long_name(dso, strdup(filename), true);
dso__set_kernel(dso, DSO_SPACE__KERNEL);
__dsos__add(dsos, dso);
up_write(&dsos->lock); return dso;
}
staticint dsos__find_kernel_dso_cb(struct dso *dso, void *data)
{ struct dso **res = data; /* * The cpumode passed to is_kernel_module is not the cpumode of *this* * event. If we insist on passing correct cpumode to is_kernel_module, * we should record the cpumode when we adding this dso to the linked * list. * * However we don't really need passing correct cpumode. We know the * correct cpumode must be kernel mode (if not, we should not link it * onto kernel_dsos list). * * Therefore, we pass PERF_RECORD_MISC_CPUMODE_UNKNOWN. * is_kernel_module() treats it as a kernel cpumode.
*/ if (!dso__kernel(dso) ||
is_kernel_module(dso__long_name(dso), PERF_RECORD_MISC_CPUMODE_UNKNOWN)) return 0;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.