Skip to content

Instantly share code, notes, and snippets.

@Buttonwood
Created April 8, 2016 08:14
Show Gist options
  • Save Buttonwood/f46f7611198209991203c11563bd6f7c to your computer and use it in GitHub Desktop.
Save Buttonwood/f46f7611198209991203c11563bd6f7c to your computer and use it in GitHub Desktop.
Args <- commandArgs()
library('rCharts', 'ramnathv')
df <- read.csv(Args[4],header = FALSE, sep = ";")
#num <- df[,c(1,2,4,6)]
num <- df[,c(1,2,3)]
#time <- df[,c(1,3,5,7)]
colnames(num) <- c("date","num", "time")
#colnames(time) <- c("date","1", "3","20")
transform(num, date = as.character(date))
#transform(time, date = as.character(date))
#m1 <- mPlot(x = "date", y = c("num", "time"), type = "Line", data = num)
m1 <- mPlot(x = "date", y = c("num"), type = "Line", data = num)
m1$set(pointSize = 0, lineWidth = 1)
#m1$print("num")
library("base64enc")
m1$save(Args[5], 'inline', standalone=TRUE)
m1 <- mPlot(x = "date", y = c("time"), type = "Line", data = num)
m1$set(pointSize = 0, lineWidth = 1)
m1$save(Args[6], 'inline', standalone=TRUE)
@Buttonwood
Copy link
Author

perl phaser_sql.pl i-h6jvqyjm-slow.log >slow-query.log.csv
perl stat_keys.pl slow-query.log.csv >slow-query.log.keys.csv

sort -t ";" -k1,1rn -k5,5 stat.keys.csv >stat.keys.sort.csv
mkdir tmp
perl grep.pl stat.keys.sort.csv slow-query.log.keys.csv

cd tmp
cp ../date_stat.pl ./
mkdir stat
ls *.csv |awk -F '.' '{print "perl date_stat.pl "$1".csv\t>./stat/"$1".stat.csv";}' |sh

cd stat
cp ../../plot.R ./
mkdir html
ls *.stat.csv |awk '{print "R -f plot.R "$0" "$0".num.html "$0".time.html" }' |sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment