[nemiver/profiler: 33/48] Fix few bugs
- From: Fabien Parent <fparent src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nemiver/profiler: 33/48] Fix few bugs
- Date: Wed, 15 Aug 2012 10:01:26 +0000 (UTC)
commit 6394f020e1c0aeb35b4a3f33e30e891f0fd6f437
Author: Fabien Parent <parent f gmail com>
Date: Sun Jul 8 16:25:28 2012 +0200
Fix few bugs
src/profengine/nmv-perf-engine.cc | 61 +++++++++++++++++++++++--------------
1 files changed, 38 insertions(+), 23 deletions(-)
---
diff --git a/src/profengine/nmv-perf-engine.cc b/src/profengine/nmv-perf-engine.cc
index 83fe591..183db77 100644
--- a/src/profengine/nmv-perf-engine.cc
+++ b/src/profengine/nmv-perf-engine.cc
@@ -73,11 +73,11 @@ struct PerfEngine::Priv {
bool
on_wait_for_record_to_exit ()
{
- NEMIVER_TRY
-
int status = 0;
pid_t pid = waitpid (perf_pid, &status, WNOHANG);
- if (pid == perf_pid && WIFEXITED (status)) {
+ bool is_terminated = WIFEXITED (status) || WIFSIGNALED (status);
+
+ if (pid == perf_pid && is_terminated) {
g_spawn_close_pid (perf_pid);
perf_pid = 0;
master_pty_fd = 0;
@@ -89,64 +89,69 @@ struct PerfEngine::Priv {
return false;
}
- NEMIVER_CATCH_NOX
-
return true;
}
bool
on_wait_for_symbol_annotation_to_exit ()
{
- NEMIVER_TRY
-
- THROW_IF_FAIL (perf_stdout_channel);
-
int status = 0;
pid_t pid = waitpid (perf_pid, &status, WNOHANG);
- if (pid == perf_pid && WIFEXITED (status)) {
+ bool is_terminated = WIFEXITED (status) || WIFSIGNALED (status);
+
+ if (pid == perf_pid && is_terminated) {
+ NEMIVER_TRY;
+ THROW_IF_FAIL (perf_stdout_channel);
perf_stdout_channel->close ();
perf_stdout_channel.reset ();
+
g_spawn_close_pid (perf_pid);
perf_pid = 0;
master_pty_fd = 0;
perf_stdout_fd = 0;
perf_stderr_fd = 0;
- symbol_annotated_signal.emit (annotated_symbol, annotation_buffer);
+ THROW_IF_FAIL (WIFEXITED (status));
+ if (WEXITSTATUS (status) == 0) {
+ symbol_annotated_signal.emit
+ (annotated_symbol, annotation_buffer);
+ }
+
+ NEMIVER_CATCH_NOX
return false;
}
- NEMIVER_CATCH_NOX
-
return true;
}
bool
on_wait_for_report_to_exit ()
{
- NEMIVER_TRY
-
- THROW_IF_FAIL (perf_stdout_channel);
-
int status = 0;
pid_t pid = waitpid (perf_pid, &status, WNOHANG);
- if (pid == perf_pid && WIFEXITED (status)) {
+ bool is_terminated = WIFEXITED (status) || WIFSIGNALED (status);
+
+ if (pid == perf_pid && is_terminated) {
+ NEMIVER_TRY;
+
+ THROW_IF_FAIL (perf_stdout_channel);
perf_stdout_channel->close ();
perf_stdout_channel.reset ();
+
g_spawn_close_pid (perf_pid);
perf_pid = 0;
master_pty_fd = 0;
perf_stdout_fd = 0;
perf_stderr_fd = 0;
+ THROW_IF_FAIL (WIFEXITED (status) && WEXITSTATUS (status) == 0);
report_done_signal.emit (call_graph);
+ NEMIVER_CATCH_NOX;
return false;
}
- NEMIVER_CATCH_NOX
-
return true;
}
@@ -216,9 +221,19 @@ struct PerfEngine::Priv {
THROW_IF_FAIL (node);
node->overhead (overhead);
- std::vector<UString>::const_iterator first_symbol_token = a_tokens.begin () + 4;
- std::vector<UString>::const_iterator last_symbol_token = a_tokens.end ();
- node->symbol (str_utils::join (first_symbol_token, last_symbol_token));
+ if (a_tokens.size () > 4)
+ {
+ std::vector<UString>::const_iterator first_symbol_token =
+ a_tokens.begin () + 4;
+ std::vector<UString>::const_iterator last_symbol_token =
+ a_tokens.end ();
+ node->symbol
+ (str_utils::join (first_symbol_token, last_symbol_token));
+ }
+ else
+ {
+ node->symbol (a_tokens[a_tokens.size () - 1]);
+ }
THROW_IF_FAIL (call_stack.top ());
call_stack.top ()->add_child (node);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]