[memprof: 73/76] memprof: Start recording only if we were recording before.
- From: Holger Hans Peter Freyther <hfreyther src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [memprof: 73/76] memprof: Start recording only if we were recording before.
- Date: Sun, 13 Jun 2010 03:44:22 +0000 (UTC)
commit 7f851f0602e429fd882fdfcf93ea886096d334c8
Author: Holger Hans Peter Freyther <zecke selfish org>
Date: Thu Apr 15 10:38:49 2010 +0200
memprof: Start recording only if we were recording before.
When the recording of samples was stopped and we would hit the
profile button the recording would be started again and the toggle
button would show the wrong state. Fix that by only starting to
sample again when we were sampling before generating the profile.
src/main.c | 5 ++++-
src/process.c | 6 ++++++
src/process.h | 1 +
3 files changed, 11 insertions(+), 1 deletions(-)
---
diff --git a/src/main.c b/src/main.c
index 43a4924..950d1b9 100644
--- a/src/main.c
+++ b/src/main.c
@@ -1187,9 +1187,11 @@ generate_leak_cb (GtkWidget *widget)
void
generate_profile_cb (GtkWidget *widget)
{
+ gboolean was_recording;
ProcessWindow *pwin = pwin_from_widget (widget);
if (pwin->process) {
+ was_recording = process_is_recording (pwin->process);
process_stop_input (pwin->process);
if (pwin->profile) {
@@ -1198,7 +1200,8 @@ generate_profile_cb (GtkWidget *widget)
}
pwin->profile = profile_create (pwin->process, skip_funcs);
- process_start_input (pwin->process);
+ if (was_recording)
+ process_start_input (pwin->process);
profile_fill (pwin);
gtk_notebook_set_current_page (GTK_NOTEBOOK (pwin->main_notebook), 0);
diff --git a/src/process.c b/src/process.c
index 8461293..4fabc11 100644
--- a/src/process.c
+++ b/src/process.c
@@ -919,6 +919,12 @@ process_kill (MPProcess *process)
}
}
+gboolean
+process_is_recording (MPProcess *process)
+{
+ return process->input_tag;
+}
+
typedef struct {
MPProcessBlockForeachFunc foreach_func;
gpointer data;
diff --git a/src/process.h b/src/process.h
index 49936f9..6d3f217 100644
--- a/src/process.h
+++ b/src/process.h
@@ -137,5 +137,6 @@ void process_block_foreach (MPProcess *process,
gboolean process_find_line (MPProcess *process, void *address,
const char **filename, char **functionname,
unsigned int *line);
+gboolean process_is_recording (MPProcess *process);
#endif /* __PROCESS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]