for parallel gencharts
This commit is contained in:
parent
b23afe1441
commit
2b403cf1f2
@ -130,6 +130,7 @@ function analyze {
|
||||
cat ${g_tmp}/output-${tmpfile} >"analyze-${analyzedate}/${tmpfile}.log"
|
||||
|
||||
|
||||
# Chart Part
|
||||
if [ -s "analyze-${analyzedate}/chart-${tmpfile}" ]
|
||||
then
|
||||
g_echo "generating chart for $file from analyze-${analyzedate}/chart-${tmpfile}"
|
||||
@ -155,7 +156,7 @@ function analyze {
|
||||
genchart analyze-${analyzedate}/chart-${tmpfile} 500 10,11,12,14,15,16,17,13 >>analyze-${analyzedate}/chart-${tmpfile}.html
|
||||
echo "</body></html>">>analyze-${analyzedate}/chart-${tmpfile}.html
|
||||
fi
|
||||
|
||||
# Chart Part END
|
||||
|
||||
}
|
||||
|
||||
|
@ -10,18 +10,21 @@ function genchart {
|
||||
local colors=$4
|
||||
[ -z "${colors}" ] && colors="White,Gold,Silver,Blue,DarkMagenta,DarkViolet,Indigo,MediumBlue,DarkOrchid,MidnightBlue,CornflowerBlue,CadetBlue,DarkCyan,DarkSlateBlue,DeepSkyBlue,DodgerBlue,Teal"
|
||||
|
||||
local f_tmp_data="${g_tmp}-data-$RANDOM"
|
||||
local f_tmp_headline="${g_tmp}-headline-$RANDOM"
|
||||
|
||||
local awkfields=$(echo "${fields}" | sed 's/,/ \",\" \$/g; s/^/\$/')
|
||||
#tail -n ${lastlines} "${file}" | cut -d, -f${fields} | egrep "^[-0-9]" >${g_tmp}/g_genchart_data
|
||||
tail -n ${lastlines} "${file}" | awk -F',' "{ print $awkfields }" | perl -pe 's/,,+//g' | egrep "^[-0-9]" >${g_tmp}/g_genchart_data
|
||||
lines=$(cat ${g_tmp}/g_genchart_data | wc -l)
|
||||
#head -n1 "${file}" | cut -d, -f${fields} >${g_tmp}/g_genchart_headline
|
||||
head -n1 "${file}" | awk -F',' "{ print $awkfields }" >${g_tmp}/g_genchart_headline
|
||||
#tail -n ${lastlines} "${file}" | cut -d, -f${fields} | egrep "^[-0-9]" >${f_tmp_data}
|
||||
tail -n ${lastlines} "${file}" | awk -F',' "{ print $awkfields }" | perl -pe 's/,,+//g' | egrep "^[-0-9]" >${f_tmp_data}
|
||||
lines=$(cat ${f_tmp_data} | wc -l)
|
||||
#head -n1 "${file}" | cut -d, -f${fields} >${f_tmp_headline}
|
||||
head -n1 "${file}" | awk -F',' "{ print $awkfields }" >${f_tmp_headline}
|
||||
|
||||
local time_from=$(tail -n ${lastlines} "${file}" | head -n1 | cut -d, -f1)
|
||||
local time_to=$(tail -n1 "${file}" | cut -d, -f1)
|
||||
|
||||
local highest=$(cat ${g_tmp}/g_genchart_data | sed 's/,/\n/g' | sort -n | egrep "^[-0-9]" | tail -n1 | sed 's/^-//')
|
||||
local lowest=$(cat ${g_tmp}/g_genchart_data | sed 's/,/\n/g' | sort -n | egrep "^[-0-9]" | head -n1)
|
||||
local highest=$(cat ${f_tmp_data} | sed 's/,/\n/g' | sort -n | egrep "^[-0-9]" | tail -n1 | sed 's/^-//')
|
||||
local lowest=$(cat ${f_tmp_data} | sed 's/,/\n/g' | sort -n | egrep "^[-0-9]" | head -n1)
|
||||
if echo ${lowest} | grep -q '^-'
|
||||
then
|
||||
lowest=$(echo ${lowest} | sed 's/^-//')
|
||||
@ -34,10 +37,10 @@ function genchart {
|
||||
|
||||
#local divideby=$(echo "$highest+$lowest" | bc -l | sed 's/^\./0./; s/^-\./-0./')
|
||||
|
||||
local fieldsnum=$(cat ${g_tmp}/g_genchart_headline | sed 's/,/\n/g' | wc -l)
|
||||
local fieldsnum=$(cat ${f_tmp_headline} | sed 's/,/\n/g' | wc -l)
|
||||
|
||||
local color="green"
|
||||
tail -n1 ${g_tmp}/g_genchart_data | cut -d, -f1 | grep -q "^-" && color="red"
|
||||
tail -n1 ${f_tmp_data} | cut -d, -f1 | grep -q "^-" && color="red"
|
||||
|
||||
mkdir ${g_tmp}/g_genchart
|
||||
local RND=$RANDOM
|
||||
@ -48,8 +51,8 @@ function genchart {
|
||||
for fieldnum in $(seq ${fieldsnum} | tac)
|
||||
do
|
||||
linecolor=$(echo "$colors" | cut -d, -f${fieldnum})
|
||||
linename=$(cat ${g_tmp}/g_genchart_headline | cut -d, -f${fieldnum} | tr [:lower:] [:upper:])
|
||||
linelastvalue=$(tail -n1 ${g_tmp}/g_genchart_data | cut -d, -f${fieldnum})
|
||||
linename=$(cat ${f_tmp_headline} | cut -d, -f${fieldnum} | tr [:lower:] [:upper:])
|
||||
linelastvalue=$(tail -n1 ${f_tmp_data} | cut -d, -f${fieldnum})
|
||||
if [ ${fieldnum} -eq 1 ]
|
||||
then
|
||||
echo "<p class='legend'><font color='${color}'>${linename} (${linelastvalue})</font></p>"
|
||||
@ -57,7 +60,7 @@ function genchart {
|
||||
echo "<p class='legend'><font color='${linecolor}'>${linename} (${linelastvalue})</font></p>"
|
||||
fi >>${g_tmp}/g_genchart/legend
|
||||
local linenum=1
|
||||
for line in $(cat ${g_tmp}/g_genchart_data)
|
||||
for line in $(cat ${f_tmp_data})
|
||||
do
|
||||
for mark in $(echo ${line} | cut -d, -f${fieldnum})
|
||||
do
|
||||
@ -87,7 +90,7 @@ function genchart {
|
||||
echo "</table></div>"
|
||||
|
||||
# legend
|
||||
if grep -q ',' ${g_tmp}/g_genchart_headline
|
||||
if grep -q ',' ${f_tmp_headline}
|
||||
then
|
||||
echo "<td id='noborder'>"
|
||||
tac ${g_tmp}/g_genchart/legend
|
||||
|
Loading…
Reference in New Issue
Block a user