function performance_install in Performance Logging and Monitoring 5
Same name and namespace in other branches
- 6.2 performance.install \performance_install()
- 6 performance.install \performance_install()
- 7.2 performance.install \performance_install()
- 7 performance.install \performance_install()
File
- ./
performance.install, line 5
Code
function performance_install() {
switch ($GLOBALS['db_type']) {
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE {performance_detail} (\n pid INT NOT NULL AUTO_INCREMENT,\n timestamp INT NOT NULL DEFAULT '0',\n bytes INT NOT NULL DEFAULT '0',\n millisecs INT NOT NULL DEFAULT '0',\n query_count INT NOT NULL DEFAULT '0',\n query_timer INT NOT NULL DEFAULT '0',\n anon INT(1) DEFAULT '1',\n title VARCHAR(255) DEFAULT NULL,\n path VARCHAR(255) DEFAULT NULL,\n PRIMARY KEY (pid),\n KEY (timestamp)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
db_query("CREATE TABLE {performance_summary} (\n path VARCHAR(255) NOT NULL DEFAULT '',\n last_access INT NOT NULL DEFAULT '0',\n bytes_max INT NOT NULL DEFAULT '0',\n bytes_avg INT NOT NULL DEFAULT '0',\n millisecs_max INT NOT NULL DEFAULT '0',\n millisecs_avg INT NOT NULL DEFAULT '0',\n query_count_max INT NOT NULL DEFAULT '0',\n query_count_avg INT NOT NULL DEFAULT '0',\n query_timer_max INT NOT NULL DEFAULT '0',\n query_timer_avg INT NOT NULL DEFAULT '0',\n num_accesses INT NOT NULL DEFAULT '0',\n title VARCHAR(255) DEFAULT NULL,\n PRIMARY KEY (path),\n KEY (last_access)\n ) /*!40100 DEFAULT CHARACTER SET UTF8 */ ");
break;
case 'pgsql':
db_query("CREATE TABLE {performance_detail} (\n pid SERIAL,\n timestamp INT NOT NULL DEFAULT '0',\n bytes INT NOT NULL DEFAULT '0',\n millisecs INT NOT NULL DEFAULT '0',\n query_count INT NOT NULL DEFAULT '0',\n query_timer INT NOT NULL DEFAULT '0',\n anon SMALLINT DEFAULT '1',\n title VARCHAR(255) DEFAULT NULL,\n path VARCHAR(255) DEFAULT NULL,\n PRIMARY KEY (pid)\n )");
db_query("CREATE INDEX {performance_detail}_timestamp_idx ON {peformance_detail} (timestamp)");
db_query("CREATE TABLE {performance_summary} (\n path VARCHAR(255) NOT NULL DEFAULT '',\n last_access INT NOT NULL DEFAULT '0',\n bytes_max INT NOT NULL DEFAULT '0',\n bytes_avg INT NOT NULL DEFAULT '0',\n millisecs_max INT NOT NULL DEFAULT '0',\n millisecs_avg INT NOT NULL DEFAULT '0',\n query_count_max INT NOT NULL DEFAULT '0',\n query_count_avg INT NOT NULL DEFAULT '0',\n query_timer_max INT NOT NULL DEFAULT '0',\n query_timer_avg INT NOT NULL DEFAULT '0',\n num_accesses INT NOT NULL DEFAULT '0',\n title VARCHAR(255) DEFAULT NULL,\n PRIMARY KEY (path)\n )");
db_query("CREATE INDEX {performance_summary}_last_access_idx ON {performance_summary} (last_access)");
break;
}
// Set the weight so this module runs last
db_query("UPDATE {system} SET weight = 3000 WHERE name = 'performance'");
}