// SPDX-License-Identifier: GPL-2.0 /* * Infrastructure for statistic tracing (histogram output). * * Copyright (C) 2008-2009 Frederic Weisbecker <fweisbec@gmail.com> * * Based on the code from trace_branch.c which is * Copyright (C) 2008 Steven Rostedt <srostedt@redhat.com> *
*/
/* * List of stat red-black nodes from a tracer * We use a such tree to sort quickly the stat * entries from the tracer.
*/ struct stat_node { struct rb_node node; void *stat;
};
/* A stat session is the stats output in one file */ struct stat_session { struct list_head session_list; struct tracer_stat *ts; struct rb_root stat_root; struct mutex stat_mutex; struct dentry *file;
};
/* All of the sessions currently in use. Each stat file embed one session */ static LIST_HEAD(all_stat_sessions); static DEFINE_MUTEX(all_stat_sessions_mutex);
/* The root directory for all stat files */ staticstruct dentry *stat_dir;
rbtree_postorder_for_each_entry_safe(snode, n, &session->stat_root, node) { if (session->ts->stat_release)
session->ts->stat_release(snode->stat);
kfree(snode);
}
/* * For tracers that don't provide a stat_cmp callback. * This one will force an insertion as right-most node * in the rbtree.
*/ staticint dummy_cmp(constvoid *p1, constvoid *p2)
{ return -1;
}
/* * Initialize the stat rbtree at each trace_stat file opening. * All of these copies and sorting are required on all opening * since the stats could have changed between two file sessions.
*/ staticint stat_seq_init(struct stat_session *session)
{ struct tracer_stat *ts = session->ts; struct rb_root *root = &session->stat_root; void *stat; int ret = 0; int i;
/* The session stat is refilled and resorted at each stat file opening */ staticint tracing_stat_open(struct inode *inode, struct file *file)
{ int ret; struct seq_file *m; struct stat_session *session = inode->i_private;
ret = security_locked_down(LOCKDOWN_TRACEFS); if (ret) return ret;
ret = stat_seq_init(session); if (ret) return ret;
ret = seq_open(file, &trace_stat_seq_ops); if (ret) {
reset_stat_session(session); return ret;
}
m = file->private_data;
m->private = session; return ret;
}
¤ 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.0.11Bemerkung:
(vorverarbeitet)
¤
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.