#At file:///home/malff/BZR-TREE/mysql-6.0-perf/
2717 Marc Alff 2008-10-27
command line options, continued
modified:
storage/perfschema/psm_server.cc
=== modified file 'storage/perfschema/psm_server.cc'
--- a/storage/perfschema/psm_server.cc 2008-10-22 22:21:54 +0000
+++ b/storage/perfschema/psm_server.cc 2008-10-27 16:37:45 +0000
@@ -26,6 +26,13 @@ struct psm_option
static void psm_help();
+/**
+ Global performance schema flag.
+ Indicate if the performance schema is enabled.
+ This flag is set at startup, and never changes.
+*/
+static uint psm_enabled= 1;
+
#ifdef PSM_MAX_SYNC_INFO
static uint sync_info_sizing= PSM_MAX_SYNC_INFO;
#else
@@ -69,6 +76,13 @@ struct psm_option all_psm_options[] =
psm_help
},
{
+ "--psm-enabled",
+ "Enable the performance schema.",
+ OPTION_BOOL,
+ & psm_enabled,
+ NULL
+ },
+ {
"--psm-max-sync-info",
"Maximum number of sync info objects.",
OPTION_UINT,
@@ -118,9 +132,19 @@ void print_help(FILE *where)
{
fprintf(where, "\n%s", option->m_name);
switch (option->m_type) {
- case OPTION_FUNC: fprintf(where, "\n"); break;
- case OPTION_BOOL: fprintf(where, "={true|false}\n"); break;
- case OPTION_UINT: fprintf(where, "=<number>\n"); break;
+ case OPTION_FUNC:
+ fprintf(where, "\n");
+ break;
+ case OPTION_BOOL:
+ fprintf(where, "={true|false}\n");
+ fprintf(where, " default=%s\n",
+ (*(option->m_value)) ? "true" : "false");
+ break;
+ case OPTION_UINT:
+ fprintf(where, "=<number>\n");
+ fprintf(where, " default=%d\n",
+ (*(option->m_value)));
+ break;
default: DBUG_ASSERT(FALSE);
}
fprintf(where, " %s\n", option->m_help);
@@ -187,8 +211,17 @@ int process_option(psm_option *option, c
{
if (strcasecmp(param_position, "true") == 0)
*(option->m_value)= 1;
- else
+ else if (strcasecmp(param_position, "false") == 0)
*(option->m_value)= 0;
+ else
+ {
+ fprintf(stderr,
+ "Invalid value <%s> for performance schema option <%s>\n",
+ param_position,
+ option->m_name);
+ psm_usage();
+ exit(EXIT_ARGUMENT_INVALID);
+ }
break;
}
case OPTION_UINT:
@@ -323,9 +356,25 @@ initialize_performance_schema(int argc_i
parse_args(argc_input, argv_input, argc_output, argv_output);
+ if (! psm_enabled)
+ {
+ /*
+ The performance schema is disabled in the startup command line.
+ All the instrumentation is turned off.
+ */
+ return NULL;
+ }
+
if (init_sync_info(sync_info_sizing) ||
init_sync(mutex_sizing, rwlock_sizing, cond_sizing))
+ {
+ /*
+ The performance schema initialization failed.
+ Free the memory used, and disable the instrumentation.
+ */
+ shutdown_performance_schema();
return NULL;
+ }
psm_initialized= 1;
return & PSM_boostrap;
@@ -342,5 +391,6 @@ int initialize_performance_schema_pthrea
void shutdown_performance_schema()
{
cleanup_sync_info();
+ cleanup_sync();
}
| Thread |
|---|
| • bzr commit into mysql-6.0-perf branch (marc.alff:2717) | Marc Alff | 27 Oct |