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