gimp/app/actions/dashboard-actions.c

231 lines
8.5 KiB
C
Raw Normal View History

/* GIMP - The GNU Image Manipulation Program
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gegl.h>
#include <gtk/gtk.h>
#include "libgimpwidgets/gimpwidgets.h"
#include "actions-types.h"
#include "widgets/gimpactiongroup.h"
#include "widgets/gimpdashboard.h"
#include "widgets/gimphelp-ids.h"
#include "dashboard-actions.h"
#include "dashboard-commands.h"
#include "gimp-intl.h"
static const GimpActionEntry dashboard_actions[] =
{
{ "dashboard-popup", GIMP_ICON_DIALOG_DASHBOARD,
NC_("dashboard-action", "Dashboard Menu"), NULL, NULL, NULL,
GIMP_HELP_DASHBOARD_DIALOG },
{ "dashboard-groups", NULL,
NC_("dashboard-action", "_Groups") },
{ "dashboard-update-interval", NULL,
NC_("dashboard-action", "_Update Interval") },
{ "dashboard-history-duration", NULL,
NC_("dashboard-action", "_History Duration") },
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
{ "dashboard-log-record", GIMP_ICON_RECORD,
NC_("dashboard-action", "_Start/Stop Recording..."), NULL,
NC_("dashboard-action", "Start/stop recording performance log"),
dashboard_log_record_cmd_callback,
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
GIMP_HELP_DASHBOARD_LOG_RECORD },
{ "dashboard-log-add-marker", GIMP_ICON_MARKER,
NC_("dashboard-action", "_Add Marker..."), NULL,
NC_("dashboard-action", "Add an event marker "
"to the performance log"),
dashboard_log_add_marker_cmd_callback,
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
GIMP_HELP_DASHBOARD_LOG_ADD_MARKER },
{ "dashboard-log-add-empty-marker", GIMP_ICON_MARKER,
NC_("dashboard-action", "Add _Empty Marker"), NULL,
NC_("dashboard-action", "Add an empty event marker "
"to the performance log"),
dashboard_log_add_empty_marker_cmd_callback,
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
GIMP_HELP_DASHBOARD_LOG_ADD_EMPTY_MARKER },
{ "dashboard-reset", GIMP_ICON_RESET,
NC_("dashboard-action", "_Reset"), NULL,
NC_("dashboard-action", "Reset cumulative data"),
dashboard_reset_cmd_callback,
GIMP_HELP_DASHBOARD_RESET },
};
static const GimpToggleActionEntry dashboard_toggle_actions[] =
{
{ "dashboard-low-swap-space-warning", NULL,
NC_("dashboard-action", "_Low Swap Space Warning"), NULL,
NC_("dashboard-action", "Raise the dashboard when "
"the swap size approaches its limit"),
dashboard_low_swap_space_warning_cmd_callback,
FALSE,
GIMP_HELP_DASHBOARD_LOW_SWAP_SPACE_WARNING }
};
static const GimpRadioActionEntry dashboard_update_interval_actions[] =
{
{ "dashboard-update-interval-0-25-sec", NULL,
NC_("dashboard-update-interval", "0.25 Seconds"), NULL, NULL,
GIMP_DASHBOARD_UPDATE_INTERVAL_0_25_SEC,
GIMP_HELP_DASHBOARD_UPDATE_INTERVAL },
{ "dashboard-update-interval-0-5-sec", NULL,
NC_("dashboard-update-interval", "0.5 Seconds"), NULL, NULL,
GIMP_DASHBOARD_UPDATE_INTERVAL_0_5_SEC,
GIMP_HELP_DASHBOARD_UPDATE_INTERVAL },
{ "dashboard-update-interval-1-sec", NULL,
NC_("dashboard-update-interval", "1 Second"), NULL, NULL,
GIMP_DASHBOARD_UPDATE_INTERVAL_1_SEC,
GIMP_HELP_DASHBOARD_UPDATE_INTERVAL },
{ "dashboard-update-interval-2-sec", NULL,
NC_("dashboard-update-interval", "2 Seconds"), NULL, NULL,
GIMP_DASHBOARD_UPDATE_INTERVAL_2_SEC,
GIMP_HELP_DASHBOARD_UPDATE_INTERVAL },
{ "dashboard-update-interval-4-sec", NULL,
NC_("dashboard-update-interval", "4 Seconds"), NULL, NULL,
GIMP_DASHBOARD_UPDATE_INTERVAL_4_SEC,
GIMP_HELP_DASHBOARD_UPDATE_INTERVAL }
};
static const GimpRadioActionEntry dashboard_history_duration_actions[] =
{
{ "dashboard-history-duration-15-sec", NULL,
NC_("dashboard-history-duration", "15 Seconds"), NULL, NULL,
GIMP_DASHBOARD_HISTORY_DURATION_15_SEC,
GIMP_HELP_DASHBOARD_HISTORY_DURATION },
{ "dashboard-history-duration-30-sec", NULL,
NC_("dashboard-history-duration", "30 Seconds"), NULL, NULL,
GIMP_DASHBOARD_HISTORY_DURATION_30_SEC,
GIMP_HELP_DASHBOARD_HISTORY_DURATION },
{ "dashboard-history-duration-60-sec", NULL,
NC_("dashboard-history-duration", "60 Seconds"), NULL, NULL,
GIMP_DASHBOARD_HISTORY_DURATION_60_SEC,
GIMP_HELP_DASHBOARD_HISTORY_DURATION },
{ "dashboard-history-duration-120-sec", NULL,
NC_("dashboard-history-duration", "120 Seconds"), NULL, NULL,
GIMP_DASHBOARD_HISTORY_DURATION_120_SEC,
GIMP_HELP_DASHBOARD_HISTORY_DURATION },
{ "dashboard-history-duration-240-sec", NULL,
NC_("dashboard-history-duration", "240 Seconds"), NULL, NULL,
GIMP_DASHBOARD_HISTORY_DURATION_240_SEC,
GIMP_HELP_DASHBOARD_HISTORY_DURATION }
};
void
dashboard_actions_setup (GimpActionGroup *group)
{
gimp_action_group_add_actions (group, "dashboard-action",
dashboard_actions,
G_N_ELEMENTS (dashboard_actions));
gimp_action_group_add_toggle_actions (group, "dashboard-action",
dashboard_toggle_actions,
G_N_ELEMENTS (dashboard_toggle_actions));
gimp_action_group_add_radio_actions (group, "dashboard-update-interval",
dashboard_update_interval_actions,
G_N_ELEMENTS (dashboard_update_interval_actions),
NULL,
0,
dashboard_update_interval_cmd_callback);
gimp_action_group_add_radio_actions (group, "dashboard-history-duration",
dashboard_history_duration_actions,
G_N_ELEMENTS (dashboard_history_duration_actions),
NULL,
0,
dashboard_history_duration_cmd_callback);
}
void
dashboard_actions_update (GimpActionGroup *group,
gpointer data)
{
GimpDashboard *dashboard = GIMP_DASHBOARD (data);
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
gboolean recording;
recording = gimp_dashboard_log_is_recording (dashboard);
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
#define SET_SENSITIVE(action,condition) \
gimp_action_group_set_action_sensitive (group, action, (condition) != 0, NULL)
#define SET_ACTIVE(action,condition) \
gimp_action_group_set_action_active (group, action, (condition) != 0)
switch (gimp_dashboard_get_update_interval (dashboard))
{
case GIMP_DASHBOARD_UPDATE_INTERVAL_0_25_SEC:
SET_ACTIVE ("dashboard-update-interval-0-25-sec", TRUE);
break;
case GIMP_DASHBOARD_UPDATE_INTERVAL_0_5_SEC:
SET_ACTIVE ("dashboard-update-interval-0-5-sec", TRUE);
break;
case GIMP_DASHBOARD_UPDATE_INTERVAL_1_SEC:
SET_ACTIVE ("dashboard-update-interval-1-sec", TRUE);
break;
case GIMP_DASHBOARD_UPDATE_INTERVAL_2_SEC:
SET_ACTIVE ("dashboard-update-interval-2-sec", TRUE);
break;
case GIMP_DASHBOARD_UPDATE_INTERVAL_4_SEC:
SET_ACTIVE ("dashboard-update-interval-4-sec", TRUE);
break;
}
switch (gimp_dashboard_get_history_duration (dashboard))
{
case GIMP_DASHBOARD_HISTORY_DURATION_15_SEC:
SET_ACTIVE ("dashboard-history-duration-15-sec", TRUE);
break;
case GIMP_DASHBOARD_HISTORY_DURATION_30_SEC:
SET_ACTIVE ("dashboard-history-duration-30-sec", TRUE);
break;
case GIMP_DASHBOARD_HISTORY_DURATION_60_SEC:
SET_ACTIVE ("dashboard-history-duration-60-sec", TRUE);
break;
case GIMP_DASHBOARD_HISTORY_DURATION_120_SEC:
SET_ACTIVE ("dashboard-history-duration-120-sec", TRUE);
break;
case GIMP_DASHBOARD_HISTORY_DURATION_240_SEC:
SET_ACTIVE ("dashboard-history-duration-240-sec", TRUE);
break;
}
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
SET_SENSITIVE ("dashboard-log-add-marker", recording);
SET_SENSITIVE ("dashboard-log-add-empty-marker", recording);
SET_SENSITIVE ("dashboard-reset", !recording);
SET_ACTIVE ("dashboard-low-swap-space-warning",
gimp_dashboard_get_low_swap_space_warning (dashboard));
app, icons, menus: add performance-log recording to the dashboard Add an option to record a performance log through the dashboard. The log contains a series of samples of the dashboard variables, as well as the full program backtrace, when available. As such, it essentially acts as a built-in profiler, which allows us to correlate program execution with the information available through the dashboard. It is meant to be used for creating logs to accompany perofrmance-related bug reports, as well as for profiling GIMP during development. The sample frequency defaults to 10 samples per second, but can be overridden using the GIMP_PERFORMANCE_LOG_SAMPLE_FREQUENCY environment variable. Backtraces are included by default when available, but can be suppressed using the GIMP_PERFORMANCE_LOG_NO_BACKTRACE environment variable. Logs are created through the new "record" button at the bottom of the dashboard dialog. When pressed, a file dialog is opened to select the log file, and, once confirmed, data is being recorded to the selected file. Recording is stopped by pressing the "record" button again (we use a highlight to indicate that recording is active.) While recording, the "reset" button is replaced with an "add marker" button, which can be used to add event markers to the log. These can be used to mark events of interest, such as "started painting" and "stopped painting", which then appear in the log as part of the sample stream. Markers are numbered sequentually, and the number of the next (to-be-added) marker appears on the button. Shift- clicking the button adds an empty (description-less) marker, which is only identified by its number; this can be used when markers need to be added quickly. The log is an XML file, containing some extra information (such as the output of "$ gimp -v", and symbol information) in addition to the samples. The data in the file is delta-encoded to reduce the file size, meaning that samples (as well as some other elements) only specify the changes since the previous sample. This adds a necessary decoding step before data can be processed; the next commit adds a tool that does that. There are currently no tools to actually analyze the data -- that's still TBD -- but at least we can start gathering it.
2018-09-02 13:46:27 +08:00
#undef SET_SENSITIVE
#undef SET_ACTIVE
}