#At bzr+ssh://bk-internal.mysql.com/bzrroot/mysql-falcon/
281 Hakan Kuecuekyilmaz 2008-09-25
Added Historical DBT2 Overview graph
genaration and overview page.
added:
dbt2/historical_dbt2_overview.php
dbt2/historical_dbt2_overview.png
dbt2/historical_dbt2_overview_graph.php
modified:
dbt2/wait_for_dbt2_and_collect.sh
dbt2/weekly_dbt2_overview.php
dbt2/weekly_dbt2_overview_graph.php
per-file messages:
dbt2/wait_for_dbt2_and_collect.sh
Added call to Historical DBT2 Overview graph generator.
dbt2/weekly_dbt2_overview.php
Added link to Historical DBT2 Overview page.
dbt2/weekly_dbt2_overview_graph.php
Refinded graph generation.
=== added file 'dbt2/historical_dbt2_overview.php'
--- a/dbt2/historical_dbt2_overview.php 1970-01-01 00:00:00 +0000
+++ b/dbt2/historical_dbt2_overview.php 2008-09-25 04:54:53 +0000
@@ -0,0 +1,73 @@
+<?php
+/**
+ * Show Historical DBT2 Overview.
+ *
+ * @author Hakan Kuecuekyilmaz <hakan at mysql dot com>.
+ * @since 2007-09-25.
+ *
+ * @version $Id$
+ */
+
+define('DEBUG', false);
+// define('DEBUG', true);
+
+if (DEBUG) {
+ error_reporting(E_ALL);
+}
+
+require_once './include/dbt2_config.php';
+
+// Determine machine name from URL.
+$tmp = explode('/', $_SERVER['PHP_SELF']);
+$hostname = $tmp[2];
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <title><?php echo $hostname . ':'; ?> Historical DBT2 Overview</title>
+ <link href="./dbt2.css" rel="stylesheet" type="text/css" />
+ </head>
+<body>
+
+<div class="dbt2_head">
+ <div class="dbt2_head_img">
+ <!-- Image generated at http://www.creatr.cc/creatr/ -->
+ <img src="./historical_dbt2_overview.png" />
+ </div>
+</div>
+
+<div class="navi">
+ <a href="#">
+ 10 warehouses</a>
+ <a href="#w20">
+ 20 warehouses</a>
+ <a href="#w100">
+ 100 warehouses</a>
+ <a href="./weekly_dbt2_overview.php">
+ Latest numbers</a>
+</div>
+
+<?php
+foreach ($directories as $data) {
+?>
+<a name="<?php echo $data; ?>"></a>
+<div class="dbt2">
+ <h2>Historical DBT2 Overview of <?php echo str_replace('w', '', $data); ?> warehouses runs</h2>
+ <br />
+ <br />
+ <?php
+ foreach ($falcon_keys[$data] as $concurrency) {
+ $concurrency = str_replace('FALCON_', 'c', $concurrency);
+ echo ' <div class="dbt2_img">' . "\n";
+ echo ' <img src="./' . $data . '_' . $concurrency . '_historical_dbt2_overview_graph.png" />' . "\n";
+ echo ' </div>' . "\n";
+ echo ' <br />' . "\n";
+ }
+ ?>
+</div>
+<?php
+}
+?>
+</body>
+</html>
=== added file 'dbt2/historical_dbt2_overview.png'
Binary files a/dbt2/historical_dbt2_overview.png 1970-01-01 00:00:00 +0000 and b/dbt2/historical_dbt2_overview.png 2008-09-25 04:54:53 +0000 differ
=== added file 'dbt2/historical_dbt2_overview_graph.php'
--- a/dbt2/historical_dbt2_overview_graph.php 1970-01-01 00:00:00 +0000
+++ b/dbt2/historical_dbt2_overview_graph.php 2008-09-25 04:54:53 +0000
@@ -0,0 +1,180 @@
+<?php
+/**
+ * Generate historical graphic of Weekly DBT2 Overview of NOTPM.
+ *
+ * Requires PHP 5, jpgraph, and Weekly DBT2 Overview files.
+ * Format of files <ENGINE>_<DATE>_<CONCURRENCY>.log:
+ * <number_of_runs> runs with FALCON -c8 -t1800
+ * 9830.20 new-order transactions per minute (NOTPM)
+ *
+ * @author Hakan Kuecuekyilmaz <hky at sun dot com>.
+ * @since 2009-09-24.
+ *
+ * @version $Id$
+ */
+
+define('DBT2_LOG_DIR', './');
+
+define('DEBUG', false);
+// define('DEBUG', true);
+
+if (DEBUG) {
+ error_reporting(E_ALL);
+}
+
+require_once 'jpgraph/jpgraph.php';
+require_once 'jpgraph/jpgraph_line.php';
+require_once 'jpgraph/jpgraph_bar.php';
+
+require_once '../../include/sample_dbt2_data.php';
+require_once '../../include/dbt2_config.php';
+
+// Make list of older runs.
+$pattern = "|([0-9]{4}-[0-9]{2}-[0-9]{2})|";
+$old_runs = array();
+if ($dir = opendir(DBT2_LOG_DIR)) {
+ while (($dir_name = readdir($dir)) !== false) {
+ if ($dir_name != '.' && $dir_name != '..') {
+ if (preg_match($pattern, $dir_name, $matches)) {
+ $old_runs[] = $dir_name;
+ }
+ }
+ }
+}
+asort($old_runs);
+$x_labels = $old_runs;
+
+foreach ($directories as $wh) {
+ foreach ($old_runs as $old_date) {
+ $numbers[$wh][$old_date] = sample_dbt2_data(DBT2_LOG_DIR . "$old_date/$wh");
+ }
+}
+
+foreach ($directories as $wh) {
+ foreach ($old_runs as $old_date) {
+ $num[$wh][$old_date] = count($numbers[$wh][$old_date]) / 2;
+ }
+}
+
+// $falcon['w10'][c8] = array(YYYY-MM-DD => 14734, YYYY-MM-DD => 15289, YYYY-MM-DD => 13455, ...)
+foreach ($directories as $wh) {
+ foreach ($old_runs as $old_date) {
+ foreach ($falcon_keys[$wh] as $x_value) {
+ if (array_key_exists($x_value, $numbers[$wh][$old_date])) {
+ $falcon[$wh][$x_value][$old_date] = round($numbers[$wh][$old_date][$x_value][3]);
+ } else {
+ $falcon[$wh][$x_value][$old_date] = 0;
+ }
+ }
+
+ foreach ($innodb_keys[$wh] as $x_value) {
+ $max[$wh][$x_value] = 0;
+ if (array_key_exists($x_value, $numbers[$wh][$old_date])) {
+ $innodb[$wh][$x_value][$old_date] = round($numbers[$wh][$old_date][$x_value][3]);
+ } else {
+ $innodb[$wh][$x_value][$old_date] = 0;
+ }
+ }
+ }
+}
+
+if (DEBUG) {
+ echo '<pre>' . "\n";
+ echo '$numbers' . "\n";
+ var_dump($numbers);
+ echo '</pre>' . "\n";
+
+ echo '$num' . "\n";
+ var_dump($num);
+ echo '<br />' . "\n";
+
+ echo '<pre>' . "\n";
+ echo '$falcon' . "\n";
+ var_dump($falcon);
+ echo '</pre>' . "\n";
+
+ echo '<pre>' . "\n";
+ echo '$innodb' . "\n";
+ var_dump($innodb);
+ echo '</pre>' . "\n";
+}
+
+/**
+ * Generate graphic(s).
+ */
+foreach ($directories as $wh) {
+ foreach ($falcon_keys[$wh] as $key) {
+
+ $max[$wh][$key] = max(max($falcon[$wh][$key]), max($innodb[$wh][str_replace('FALCON', 'INNODB', $key)]));
+
+ $concurrency = 'c' . (int) str_replace('FALCON_', '', $key);
+
+ // The graph object. Width depends on number of entries.
+ $Graph = new Graph(250 + 60 * count($falcon[$wh][$key]), 350, 'auto');
+
+ $Graph->setScale('textlin', 0, $max[$wh][$key]);
+
+ $Graph->setShadow();
+ $Graph->yaxis->scale->setGrace(13, 0);
+ $Graph->yaxis->setTitleMargin(30);
+ $Graph->xaxis->setTitleMargin(10);
+ // Left, right, top, bottom.
+ $Graph->img->setMargin(65, 95, 45, 67);
+
+ $BPlot[0] = new BarPlot(array_values($falcon[$wh][$key]));
+ $BPlot[0]->setFillGradient('darkorchid4', 'darkorchid1', GRAD_LEFT_REFLECTION);
+ $BPlot[0]->setWeight(0);
+ $BPlot[0]->value->setAngle(45);
+ $BPlot[0]->value->setFont(FF_VERA, FS_NORMAL, 8);
+ $BPlot[0]->value->setFormat('%d');
+ $BPlot[0]->value->show();
+ $BPlot[0]->setLegend('Falcon');
+
+ $BPlot[1] = new BarPlot(array_values($innodb[$wh][str_replace('FALCON', 'INNODB', $key)]));
+ $BPlot[1]->setFillGradient('AntiqueWhite4', 'AntiqueWhite2', GRAD_LEFT_REFLECTION);
+ $BPlot[1]->setWeight(0);
+ $BPlot[1]->value->show();
+ $BPlot[1]->value->setFormat('%d');
+ $BPlot[1]->setLegend('InnoDB');
+
+ $GroupBarPlot = new GroupBarPlot($BPlot);
+ $GroupBarPlot->setWidth(0.75);
+ $GroupBarPlot->setAlign('center');
+
+ // Add the plot and the bars to the graphic.
+ $Graph->add($GroupBarPlot);
+
+ $Graph->legend->pos(0.015, 0.1);
+
+ // Setup the x and y grid.
+ $Graph->ygrid->setFill(true,'#DDDDDD@stripped','#BBBBBB@stripped');
+ $Graph->ygrid->setLineStyle('dashed');
+ $Graph->ygrid->setColor('gray');
+ $Graph->xgrid->show();
+ $Graph->xgrid->setLineStyle('dashed');
+ $Graph->xgrid->setColor('gray');
+
+ // Tickmarks.
+ $Graph->xaxis->setTickSide(SIDE_DOWN);
+ $Graph->yaxis->setTickSide(SIDE_LEFT);
+
+ $date = date('Y-m-d');
+ $hostname = $_SERVER['HOSTNAME'];
+ $Graph->title->set('Historical Weekly DBT2 Overview -' . $wh . '/c' . (int) str_replace('FALCON_', '', $key) . ' on ' . $hostname);
+
+ $Graph->xaxis->setFont(FF_VERA, FS_NORMAL, 8);
+ $Graph->xaxis->title->set('Date');
+ $Graph->xaxis->setTickLabels(array_keys($falcon[$wh][$key]));
+ $Graph->xaxis->SetLabelAngle(35);
+
+ $Graph->yaxis->setFont(FF_VERA, FS_NORMAL, 10);
+ $Graph->yaxis->title->set('NOTPM');
+
+ if (DEBUG) {
+ $Graph->stroke();
+ } else {
+ $Graph->stroke('../../weekly_dbt2_runs/'. $hostname . '/' . $wh . '_c' . str_replace('FALCON_', '', $key) . '_historical_dbt2_overview_graph.png');
+ }
+ }
+}
+?>
=== modified file 'dbt2/wait_for_dbt2_and_collect.sh'
--- a/dbt2/wait_for_dbt2_and_collect.sh 2008-09-12 22:05:34 +0000
+++ b/dbt2/wait_for_dbt2_and_collect.sh 2008-09-25 04:54:53 +0000
@@ -16,14 +16,14 @@ HOSTNAME=$(hostname -s)
# Directories and files.
#
WORK="/data0/work/mysql"
-BZR_BASE="$HOME/work/mysql-falcon/dbt2"
+BZR_BASE="${HOME}/work/mysql-falcon/dbt2"
PRODUCTION="hakank@stripped:~/public_html/${HOSTNAME}"
-#FALCON="$WORK/mysql-6.0"
-FALCON="$WORK/mysql-6.0-falcon"
-#FALCON="$WORK/mysql-6.0-falcon-team"
+#FALCON="${WORK}/mysql-6.0"
+FALCON="${WORK}/mysql-6.0-falcon"
+#FALCON="${WORK}/mysql-6.0-falcon-team"
-CONTROL="$FALCON/weekly_dbt2_overview_done"
+CONTROL="${FALCON}/weekly_dbt2_overview_done"
#
# Variables.
@@ -32,7 +32,7 @@ MAINTAINER_EMAIL='hakan@stripped'
CC_LIST=''
FAILED='Weekly DBT2 Overview failed'
SUCCESS="Weekly DBT2 Overview on ${HOSTNAME} succeeded"
-GRAPH="$BZR_BASE/weekly_dbt2_runs/${HOSTNAME}/w10/weekly_dbt2_overview_graph.png"
+GRAPH="${BZR_BASE}/weekly_dbt2_runs/${HOSTNAME}/w10/weekly_dbt2_overview_graph.png"
#
# Mail program to use. mail|mailx does not support -a (attachments),
@@ -64,7 +64,7 @@ while (! [ -a $CONTROL ] ); do
done
# Get machine info.
-cd $BZR_BASE/weekly_dbt2_runs/${HOSTNAME}
+cd ${BZR_BASE}/weekly_dbt2_runs/${HOSTNAME}
../../machine_info.sh > machine_info.txt
# Get mysqld configuration.
@@ -74,21 +74,26 @@ $PHP ../../get_dbt2_config.php > dbt2_co
$PHP ../../weekly_dbt2_overview_graph.php
$PHP ../../weekly_dbt2_overview_cpu_graph.php
+# Generate Historical DBT2 Overview graphs.
+cd ${BZR_BASE}/old_weekly_dbt2_runs/${HOSTNAME}
+$PHP ../../dbt2_historical_overview_graph.php
+
# Mail status
if [ $? != 0 ]; then
echo 'Weekly DBT2 Overview failed' | mail -s '[WDO ERROR]' $MAINTAINER_EMAIL
else
# Synchronize remote repository. Exclude mix.log files, because they get quite big (~50MB).
- rsync -avz --delete --cvs-exclude --exclude '*_mix.log' $BZR_BASE/old_weekly_dbt2_runs/${HOSTNAME}/ $PRODUCTION/
- rsync -avz --delete --cvs-exclude --exclude '*_mix.log' $BZR_BASE/weekly_dbt2_runs/${HOSTNAME}/ $PRODUCTION/weekly_dbt2_overview/
- rsync -avz --delete --cvs-exclude $BZR_BASE/include/ $PRODUCTION/weekly_dbt2_overview/include/
- rsync -avz --delete --cvs-exclude $BZR_BASE/images/ $PRODUCTION/weekly_dbt2_overview/images/
- rsync -avz --delete $BZR_BASE/dbt2.css $PRODUCTION/weekly_dbt2_overview/
- rsync -avz --delete $BZR_BASE/weekly_dbt2_runs/${HOSTNAME}/dbt2_config.txt $PRODUCTION/weekly_dbt2_overview/
- rsync -avz --delete $BZR_BASE/weekly_dbt2_runs/${HOSTNAME}/machine_info.txt $PRODUCTION/weekly_dbt2_overview/
- rsync -avz --delete $BZR_BASE/process-stop.png $PRODUCTION/weekly_dbt2_overview/
- rsync -avz --delete $BZR_BASE/weekly_dbt2_overview.php $PRODUCTION/weekly_dbt2_overview/
- rsync -avz --delete $BZR_BASE/weekly_dbt2_overview.png $PRODUCTION/weekly_dbt2_overview/
+ rsync -avz --delete --cvs-exclude --exclude '*_mix.log' ${BZR_BASE}/old_weekly_dbt2_runs/${HOSTNAME}/ ${PRODUCTION}/
+ rsync -avz --delete --cvs-exclude --exclude '*_mix.log' ${BZR_BASE}/weekly_dbt2_runs/${HOSTNAME}/ ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete --cvs-exclude ${BZR_BASE}/include/ ${PRODUCTION}/weekly_dbt2_overview/include/
+ rsync -avz --delete --cvs-exclude ${BZR_BASE}/images/ ${PRODUCTION}/weekly_dbt2_overview/images/
+ rsync -avz --delete ${BZR_BASE}/dbt2.css ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete ${BZR_BASE}/weekly_dbt2_runs/${HOSTNAME}/dbt2_config.txt ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete ${BZR_BASE}/weekly_dbt2_runs/${HOSTNAME}/machine_info.txt ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete ${BZR_BASE}/weekly_dbt2_runs/${HOSTNAME}/*.png ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete ${BZR_BASE}/weekly_dbt2_overview.php ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete ${BZR_BASE}/historical_dbt2_overview.png ${PRODUCTION}/weekly_dbt2_overview/
+ rsync -avz --delete ${BZR_BASE}/weekly_dbt2_overview.png ${PRODUCTION}/weekly_dbt2_overview/
if [ $? != 0 ]; then
echo "[ERROR] rsync to production for ${HOSTNAME} failed!"
=== modified file 'dbt2/weekly_dbt2_overview.php'
--- a/dbt2/weekly_dbt2_overview.php 2008-09-24 02:12:52 +0000
+++ b/dbt2/weekly_dbt2_overview.php 2008-09-25 04:54:53 +0000
@@ -356,6 +356,8 @@ if (DEBUG) {
Plain text</a>
<a href="#links">
Links to old runs</a>
+ <a href="./historical_dbt_overview.php">
+ Historical overview</a>
</div>
<?php
=== modified file 'dbt2/weekly_dbt2_overview_graph.php'
--- a/dbt2/weekly_dbt2_overview_graph.php 2008-09-24 02:12:52 +0000
+++ b/dbt2/weekly_dbt2_overview_graph.php 2008-09-25 04:54:53 +0000
@@ -109,8 +109,10 @@ foreach ($directories as $data) {
$BPlot[0] = new BarPlot($falcon[$data]);
$BPlot[0]->setFillGradient('darkorchid4', 'darkorchid1', GRAD_LEFT_REFLECTION);
$BPlot[0]->setWeight(0);
- $BPlot[0]->value->show();
+ $BPlot[0]->value->setAngle(45);
+ $BPlot[0]->value->setFont(FF_VERA, FS_NORMAL, 8);
$BPlot[0]->value->setFormat('%d');
+ $BPlot[0]->value->show();
$BPlot[0]->setLegend('Falcon');
$BPlot[1] = new BarPlot($innodb[$data]);
@@ -127,6 +129,8 @@ foreach ($directories as $data) {
// Add the plot and the bars to the graphic.
$Graph->add($GroupBarPlot);
+ $Graph->legend->pos(0.015, 0.1);
+
// Setup the x and y grid.
$Graph->ygrid->setFill(true,'#DDDDDD@stripped','#BBBBBB@stripped');
$Graph->ygrid->setLineStyle('dashed');
| Thread |
|---|
| • bzr commit into mysql-falcon branch (hky:281) | Hakan Kuecuekyilmaz | 25 Sep |