[nemiver/profiler: 35/48] Use the new conf with the profiler
- From: Fabien Parent <fparent src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/profiler: 35/48] Use the new conf with the profiler
- Date: Wed, 15 Aug 2012 10:01:36 +0000 (UTC)
commit 236332582bf7acfc8639ea6801b4b398c91cbe77
Author: Fabien Parent <parent f gmail com>
Date: Sun Jul 8 19:03:24 2012 +0200
Use the new conf with the profiler
src/persp/profperspective/nmv-prof-perspective.cc | 20 ++---
src/profengine/nmv-i-profiler.h | 12 +--
src/profengine/nmv-perf-engine.cc | 104 ++++++++++++++++-----
src/profengine/nmv-perf-engine.h | 20 +---
4 files changed, 98 insertions(+), 58 deletions(-)
---
diff --git a/src/persp/profperspective/nmv-prof-perspective.cc b/src/persp/profperspective/nmv-prof-perspective.cc
index 81cd389..2b4f20e 100644
--- a/src/persp/profperspective/nmv-prof-perspective.cc
+++ b/src/persp/profperspective/nmv-prof-perspective.cc
@@ -110,10 +110,7 @@ public:
void load_report_file (const UString &a_report_file);
void run_executable ();
void run_executable (const UString &a_program_name,
- const UString &a_arguments,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters);
+ const UString &a_arguments);
void annotate_symbol (const UString &a_symbol_name);
void close_symbol_annotation (UString a_symbol_name);
void load_toolbar ();
@@ -218,6 +215,8 @@ ProfPerspective::profiler ()
<< debugger_dynmod_name << "'");
prof = module_manager->load_iface<IProfiler>
(debugger_dynmod_name, "IProfiler");
+ THROW_IF_FAIL (prof);
+ prof->do_init (get_workbench ().get_configuration_manager ());
}
THROW_IF_FAIL (prof);
@@ -549,24 +548,19 @@ ProfPerspective::run_executable ()
return;
}
- run_executable (dialog.program_name (), dialog.arguments (),
- false, true, false);
+ run_executable (dialog.program_name (), dialog.arguments ());
}
void
ProfPerspective::run_executable (const UString &a_program_name,
- const UString &a_arguments,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters)
+ const UString &a_arguments)
{
std::vector<UString> argv = str_utils::split (a_arguments, " ");
THROW_IF_FAIL (!a_program_name.empty ());
THROW_IF_FAIL (profiler ());
- profiler ()->record (a_program_name, argv, a_scale_counter_values,
- a_do_callgraph, a_child_inherit_counters);
+ profiler ()->record (a_program_name, argv);
THROW_IF_FAIL (throbber);
throbber->start ();
@@ -612,7 +606,7 @@ void
ProfPerspective::attach_to_process (unsigned a_pid)
{
THROW_IF_FAIL (profiler ());
- profiler ()->attach_to_pid (a_pid, false, true, false);
+ profiler ()->attach_to_pid (a_pid);
THROW_IF_FAIL (throbber);
throbber->start ();
diff --git a/src/profengine/nmv-i-profiler.h b/src/profengine/nmv-i-profiler.h
index 070bc46..581cbc0 100644
--- a/src/profengine/nmv-i-profiler.h
+++ b/src/profengine/nmv-i-profiler.h
@@ -74,23 +74,19 @@ public:
symbol_annotated_signal () const = 0;
/// @}
- virtual void attach_to_pid (int a_pid,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters) = 0;
+ virtual void attach_to_pid (int a_pid) = 0;
virtual void report (const UString &a_data_file) = 0;
virtual void record (const UString &a_program_path,
- const std::vector<UString> &a_argv,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters) = 0;
+ const std::vector<UString> &a_argv) = 0;
virtual void stop_recording () = 0;
virtual void annotate_symbol (const UString &a_symbol_name) = 0;
+ virtual void do_init (IConfMgrSafePtr a_conf_mgr) = 0;
+
// virtual void attach_to_pid () = 0;
diff --git a/src/profengine/nmv-perf-engine.cc b/src/profengine/nmv-perf-engine.cc
index 183db77..a629757 100644
--- a/src/profengine/nmv-perf-engine.cc
+++ b/src/profengine/nmv-perf-engine.cc
@@ -25,6 +25,7 @@
#include "nmv-perf-engine.h"
#include "nmv-call-graph-node.h"
+#include "nmv-conf-keys.h"
#include "common/nmv-proc-utils.h"
#include "common/nmv-str-utils.h"
#include <istream>
@@ -44,6 +45,7 @@ using common::FreeUnref;
using common::DefaultRef;
struct PerfEngine::Priv {
+ IConfMgrSafePtr conf_manager;
int perf_pid;
int master_pty_fd;
int perf_stdout_fd;
@@ -61,6 +63,7 @@ struct PerfEngine::Priv {
sigc::signal<void, const UString&, const UString&> symbol_annotated_signal;
Priv () :
+ conf_manager (0),
perf_pid (0),
master_pty_fd (0),
perf_stdout_fd (0),
@@ -70,6 +73,13 @@ struct PerfEngine::Priv {
{
}
+ IConfMgr&
+ conf_mgr () const
+ {
+ THROW_IF_FAIL (conf_manager);
+ return *conf_manager;
+ }
+
bool
on_wait_for_record_to_exit ()
{
@@ -326,45 +336,99 @@ PerfEngine::~PerfEngine ()
}
void
-PerfEngine::attach_to_pid (int a_pid,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters)
+PerfEngine::do_init (IConfMgrSafePtr a_conf_mgr)
+{
+ THROW_IF_FAIL (m_priv);
+ m_priv->conf_manager = a_conf_mgr;
+}
+
+void
+PerfEngine::attach_to_pid (int a_pid)
{
std::vector<UString> argv;
argv.push_back ("--pid");
argv.push_back (UString::compose ("%1", a_pid));
- record (argv, a_scale_counter_values, a_do_callgraph,
- a_child_inherit_counters);
+ record (argv);
}
void
-PerfEngine::record (const std::vector<UString> &a_argv,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters)
+PerfEngine::record (const std::vector<UString> &a_argv)
{
SafePtr<char, DefaultRef, FreeUnref> tmp_filepath (tempnam(0, 0));
THROW_IF_FAIL (tmp_filepath);
THROW_IF_FAIL (m_priv);
m_priv->record_filepath = tmp_filepath.get ();
+ bool do_callgraph_recording = true;
+ bool do_collect_without_buffering = false;
+ bool do_collect_raw_sample_records = false;
+ bool do_system_wide_collection = false;
+ bool do_sample_addresses = false;
+ bool do_sample_timestamps = false;
+
+ if (!m_priv->conf_mgr ().get_key_value (CONF_KEY_DO_CALLGRAPH_RECORDING,
+ do_callgraph_recording)) {
+ LOG_ERROR ("failed to get gconf key "
+ << CONF_KEY_DO_CALLGRAPH_RECORDING);
+ }
+
+ if (!m_priv->conf_mgr ().get_key_value (CONF_KEY_COLLECT_WITHOUT_BUFFERING,
+ do_collect_without_buffering)) {
+ LOG_ERROR ("failed to get gconf key "
+ << CONF_KEY_COLLECT_WITHOUT_BUFFERING);
+ }
+
+ if (!m_priv->conf_mgr ().get_key_value (CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS,
+ do_collect_raw_sample_records)) {
+ LOG_ERROR ("failed to get gconf key "
+ << CONF_KEY_COLLECT_RAW_SAMPLE_RECORDS);
+ }
+
+ if (!m_priv->conf_mgr ().get_key_value (CONF_KEY_SYSTEM_WIDE_COLLECTION,
+ do_system_wide_collection)) {
+ LOG_ERROR ("failed to get gconf key "
+ << CONF_KEY_SYSTEM_WIDE_COLLECTION);
+ }
+
+ if (!m_priv->conf_mgr ().get_key_value (CONF_KEY_SAMPLE_ADDRESSES,
+ do_sample_addresses)) {
+ LOG_ERROR ("failed to get gconf key "
+ << CONF_KEY_SAMPLE_ADDRESSES);
+ }
+
+ if (!m_priv->conf_mgr ().get_key_value (CONF_KEY_SAMPLE_TIMESTAMPS,
+ do_sample_timestamps)) {
+ LOG_ERROR ("failed to get gconf key "
+ << CONF_KEY_SAMPLE_TIMESTAMPS);
+ }
std::vector<UString> argv;
argv.push_back ("perf");
argv.push_back ("record");
- if (a_scale_counter_values) {
- argv.push_back ("-l");
+ if (do_callgraph_recording) {
+ argv.push_back ("--call-graph");
}
- if (a_do_callgraph) {
- argv.push_back ("--call-graph");
+ if (do_collect_without_buffering) {
+ argv.push_back ("--no-delay");
+ }
+
+ if (do_collect_raw_sample_records) {
+ argv.push_back ("--raw-samples");
+ }
+
+ if (do_system_wide_collection) {
+ argv.push_back ("--all-cpus");
+ }
+
+ if (do_sample_addresses) {
+ argv.push_back ("--data");
}
- if (a_child_inherit_counters) {
- argv.push_back ("--inherit");
+ if (do_sample_timestamps) {
+ argv.push_back ("--timestamp");
}
argv.push_back ("--output");
@@ -385,18 +449,14 @@ PerfEngine::record (const std::vector<UString> &a_argv,
void
PerfEngine::record (const UString &a_program_path,
- const std::vector<UString> &a_argv,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters)
+ const std::vector<UString> &a_argv)
{
std::vector<UString> argv;
argv.push_back ("--");
argv.push_back (a_program_path);
argv.insert (argv.end (), a_argv.begin (), a_argv.end ());
- record (argv, a_scale_counter_values, a_do_callgraph,
- a_child_inherit_counters);
+ record (argv);
}
void
diff --git a/src/profengine/nmv-perf-engine.h b/src/profengine/nmv-perf-engine.h
index dba8094..e1616c9 100644
--- a/src/profengine/nmv-perf-engine.h
+++ b/src/profengine/nmv-perf-engine.h
@@ -43,25 +43,15 @@ public:
virtual ~PerfEngine ();
void report (const UString &a_data_file);
-
- void attach_to_pid (int a_pid,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters);
- void record (const std::vector<UString> &a_argv,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters);
+ void attach_to_pid (int a_pid);
+ void record (const std::vector<UString> &a_argv);
void record (const UString &a_program_path,
- const std::vector<UString> &a_argv,
- bool a_scale_counter_values,
- bool a_do_callgraph,
- bool a_child_inherit_counters);
-
+ const std::vector<UString> &a_argv);
void stop_recording ();
-
void annotate_symbol (const UString &a_symbol_name);
+ void do_init (IConfMgrSafePtr a_conf_mgr);
+
sigc::signal<void, CallGraphSafePtr> report_done_signal () const;
sigc::signal<void> program_exited_signal () const;
sigc::signal<void, const UString&> record_done_signal () const;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]