Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
*.pyc

# Numerous always-ignore extensions
###################
*.diff
*.err
*.orig
*.log
*.rej
*.swo
*.swp
*.vi
*~

*.sass-cache
# Folders to ignore
###################
.hg
.svn
.CVS
# OS or Editor folders
###################
.DS_Store
Icon?
Thumbs.db
ehthumbs.db
nbproject
.cache
.project
.settings
.tmproj
*.esproj
*.sublime-project
*.sublime-workspace
# Dreamweaver added files
###################
_notes
dwsync.xml
# Komodo
###################
*.komodoproject
.komodotools
4 changes: 2 additions & 2 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

This is a simple UI to put on top of the data that <a href="http://www.maatkit.org/doc/mk-query-digest.html">mk-query-digest</a> outputs. It let's you browse the query report in a more readable fashion. The aim is to display all the information from the report in a readable, navigable way.

This tool does not add anything to the `mk-query-digest` utility itself. It simply displays the data that the utility generates.
This tool does not add anything to the `mk-query-digest` utility itself. It simply displays the data that the utility generates.

The name comes from the tool's purpose - "hunting whale queries" - and Richard Crowley's free-associating mind.
The name comes from the tool's purpose - "hunting whale queries" - and Richard Crowley's free-associating mind.

## Usage

Expand Down
18 changes: 9 additions & 9 deletions dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@

# Get total amount of query time (for % later)
$q = "SELECT
SUM(query_time_sum)
FROM
SUM(query_time_sum)
FROM
{$host_conf['db_query_review_history_table']}
WHERE
WHERE
ts_max > date_sub(now(),interval {$hours} hour);";
$result = mysql_query($q);
$query_time_sum = mysql_result($result, 0);
Expand All @@ -45,10 +45,10 @@

# Get total # of queries in history window (for % later)
$q = "SELECT
SUM(ts_cnt)
FROM
SUM(ts_cnt)
FROM
{$host_conf['db_query_review_history_table']}
WHERE
WHERE
ts_max > date_sub(now(),interval $hours hour);";
$result = mysql_query($q);
$query_qty_sum = mysql_result($result, 0);
Expand All @@ -67,10 +67,10 @@
(SUM(ts_cnt)/{$query_qty_sum}*100) AS qty_pct,
(SUM(query_time_sum)/{$query_time_sum}*100) AS time_pct,
((SUM(query_time_sum)/{$query_time_sum}*100)/(SUM(ts_cnt)/{$query_qty_sum}*100)) AS ratio
FROM
FROM
{$host_conf['db_query_review_history_table']}
WHERE
ts_max > date_sub(now(),interval $hours hour)
WHERE
ts_max > date_sub(now(),interval $hours hour)
GROUP BY checksum ORDER BY $sort DESC LIMIT 20";

$result = mysql_query($q);
Expand Down
2 changes: 1 addition & 1 deletion explain.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$row = mysql_fetch_assoc($result);
$query = $row['sample'];
$explain = "EXPLAIN ".preg_replace('|^\s*\/\*.*\*\/|', '', $query);

mysql_select_db($host_conf['db_database_live']) or die("Unable to select database");

$is_select_query = (stripos($explain, 'SELECT') !== false);
Expand Down
2 changes: 1 addition & 1 deletion init.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function ish_get_host_config($host) {
return $host_config;
}

# build up a query string using 1. things we need in every URL and
# build up a query string using 1. things we need in every URL and
# 2. whatever is passed in $args as k-v pairs
function ish_build_query($args) {
global $host;
Expand Down
50 changes: 25 additions & 25 deletions media/BitmapType.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var BitmapType = function() {

return {

// Insert a canvas element in place of text.

convert: function(el, attr) {
Expand All @@ -25,31 +25,31 @@ var BitmapType = function() {
for(var index = 0, position = 0, rows = 1, tLen = tokens.length; index < tLen; index++) {
var token = tokens[index],
glyph = font[token];

for(var n = index, len = tokens.length; n < len; n++) {
if(tokens[n] === 'space') break;
}
var nextSpace = n;
var wordWidth = BitmapType.calculateLength(tokens.slice(index, nextSpace), font, scale).totalWidth;
var letterWidth = BitmapType.calculateLength(tokens.slice(index, index + 1), font, scale).totalWidth;

if((position + wordWidth > width) && ((tokens[index - 1] === 'space' && wordWidth <= width) || (position + letterWidth > width))) {
rows++;
position = 0;
}
position += (glyph[0].length + 1) * scale;
position += (glyph[0].length + 1) * scale;
}
height = length.lineHeight * rows;

var angle = attr.angle || 0;
var canvasWidth = (angle === 90 || angle === 270) ? height : width;
var canvasHeight = (angle === 90 || angle === 270) ? width : height;

if(YAHOO.env.ua.webkit >= 412 && YAHOO.env.ua.webkit < 522) { // Safari 2
canvas.style.width = canvasWidth + 'px';
canvas.style.height = canvasHeight + 'px';
}
else {
else {
canvas.width = canvasWidth;
canvas.height = canvasHeight;
}
Expand All @@ -59,9 +59,9 @@ var BitmapType = function() {
canvas = YAHOO.util.Dom.get(el.id + '-bitmap-type-canvas'); // Get a new reference to the canvas.
}
var ctx = canvas.getContext('2d');

// Get the current color of the text.

var color = '#000'; // Default color.
if(el.currentStyle) { // IE
color = el.currentStyle['color'];
Expand All @@ -79,9 +79,9 @@ var BitmapType = function() {
row = position[1];
}
},

// Draw text on a canvas element.

addStringToCanvas: function(text, ctx, attr) {
var x = attr.x || 0;
var y = attr.y || 0;
Expand All @@ -91,7 +91,7 @@ var BitmapType = function() {
var angle = attr.angle || 0;
var color = attr.color || '#000';
var textAlign = attr.textAlign || 'left';

var tokens = BitmapType.tokenize(text);

var length = BitmapType.calculateLength(tokens, font, scale, lineSpacing);
Expand All @@ -101,19 +101,19 @@ var BitmapType = function() {
for(var index = 0, position = 0, rows = 1, tLen = tokens.length; index < tLen; index++) {
var token = tokens[index],
glyph = font[token];

for(var n = index, len = tokens.length; n < len; n++) {
if(tokens[n] === 'space') break;
}
var nextSpace = n;
var wordWidth = BitmapType.calculateLength(tokens.slice(index, nextSpace), font, scale).totalWidth;
var letterWidth = BitmapType.calculateLength(tokens.slice(index, index + 1), font, scale).totalWidth;

if((position + wordWidth > width) && ((tokens[index - 1] === 'space' && wordWidth <= width) || (position + letterWidth > width))) {
rows++;
position = 0;
}
position += (glyph[0].length + 1) * scale;
position += (glyph[0].length + 1) * scale;
}
height = length.lineHeight * rows;
ctx.fillStyle = color;
Expand All @@ -128,9 +128,9 @@ var BitmapType = function() {
row = position[1];
}
},

// Helper methods.

tokenize: function(text) {
if(text === null || text === undefined) text = '';
text = text.toString().replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&amp;/g, '&');
Expand Down Expand Up @@ -165,13 +165,13 @@ var BitmapType = function() {
case ',': token = 'comma'; break; case '.': token = 'period'; break;
case '/': token = 'rightSlash'; break; case '<': token = 'leftAngleBracket'; break;
case '>': token = 'rightAngleBracket'; break; case '?': token = 'questionMark'; break;
default: token = '';
default: token = '';
}
if(token !== '') tokens.push(token);
}
}
return tokens;
},

calculateLength: function(tokens, font, scale, lineSpacing) {
var length = { totalWidth: 0 };
for(var n = 0, len = tokens.length; n < len; n++) {
Expand All @@ -181,21 +181,21 @@ var BitmapType = function() {
length.lineHeight = (font['space'].length + lineSpacing) * scale;
return length;
},

translate: function(tokens, index, position, row, width, height, ctx, font, angle, scale, length, x, y) {
if(x === undefined) x = 0;
if(y === undefined) y = 0;
if(y === undefined) y = 0;

var token = tokens[index],
glyph = font[token];

for(var n = index, len = tokens.length; n < len; n++) {
if(tokens[n] === 'space') break;
}
var nextSpace = n;
var wordWidth = BitmapType.calculateLength(tokens.slice(index, nextSpace), font, scale).totalWidth;
var letterWidth = BitmapType.calculateLength(tokens.slice(index, index + 1), font, scale).totalWidth;

if((position + wordWidth > width) && ((tokens[index - 1] === 'space' && wordWidth <= width) || (position + letterWidth > width))) {
row++;
position = 0;
Expand All @@ -206,7 +206,7 @@ var BitmapType = function() {
switch(angle) {
case 90: ctx.fillRect(len - n + x, m + position + y, scale, scale); break;
case 180: ctx.fillRect(length - (m + position) - 1 + x, len - n + y, scale, scale); break;
case 270: ctx.fillRect(n + x, length - (m + position) - 1 + y, scale, scale); break;
case 270: ctx.fillRect(n + x, length - (m + position) - 1 + y, scale, scale); break;
default: ctx.fillRect(m + position + x, n + (row * height) + y, scale, scale); break;
}
}
Expand Down
4 changes: 2 additions & 2 deletions media/Fonts.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ var Fonts = {
eight: [[0,0,0,0],[0,1,1,0],[1,0,0,1],[0,1,1,0],[1,0,0,1],[0,1,1,0],[0,0,0,0]],
nine: [[0,0,0,0],[0,1,1,0],[1,0,0,1],[0,1,1,1],[0,0,0,1],[0,1,1,0],[0,0,0,0]],
zero: [[0,0,0,0],[0,1,1,0],[1,0,0,1],[1,0,0,1],[1,0,0,1],[0,1,1,0],[0,0,0,0]],

exclaimationPoint: [[0],[1],[1],[1],[0],[1],[0]],
at: [[0,0,0,0,0],[0,1,1,1,0],[1,0,1,0,1],[1,0,1,1,0],[1,0,0,0,0],[0,1,1,1,0],[0,0,0,0,0]],
hash: [[0,0,0,0,0],[0,1,0,1,0],[1,1,1,1,1],[0,1,0,1,0],[1,1,1,1,1],[0,1,0,1,0],[0,0,0,0,0]],
Expand Down Expand Up @@ -167,7 +167,7 @@ var Fonts = {
eight: [[0,0,0,0,0],[0,0,0,0,0],[0,1,1,1,0],[1,0,0,0,1],[1,0,0,0,1],[0,1,1,1,0],[1,0,0,0,1],[1,0,0,0,1],[0,1,1,1,0],[0,0,0,0,0],[0,0,0,0,0]],
nine: [[0,0,0,0,0],[0,0,0,0,0],[0,1,1,1,0],[1,0,0,0,1],[1,0,0,0,1],[1,0,0,0,1],[0,1,1,1,1],[0,0,0,0,1],[0,1,1,1,0],[0,0,0,0,0],[0,0,0,0,0]],
zero: [[0,0,0,0,0],[0,0,0,0,0],[0,1,1,1,0],[1,0,0,0,1],[1,0,0,1,1],[1,0,1,0,1],[1,1,0,0,1],[1,0,0,0,1],[0,1,1,1,0],[0,0,0,0,0],[0,0,0,0,0]],

exclaimationPoint: [[0,0,0,0,0],[0,0,0,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,1,0,0],[0,0,0,0,0],[0,0,0,0,0]],
at: [[0,0,0,0,0],[0,1,1,1,0],[1,0,0,0,1],[1,0,0,0,1],[1,0,1,0,1],[1,1,1,0,1],[1,0,1,1,0],[1,0,0,0,0],[1,0,0,0,1],[0,1,1,1,0],[0,0,0,0,0]],
hash: [[0,0,0,0,0],[0,0,0,0,0],[0,1,0,1,0],[1,1,1,1,1],[0,1,0,1,0],[1,1,1,1,1],[0,1,0,1,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]],
Expand Down
34 changes: 17 additions & 17 deletions media/graph.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading