Import Poul-Henning Kamp's PR statistics into the web tree.

Move the legend over to the upper left hand side, so it doesn't
obscure part of the generated graphs.

Obtained from:	http://phk.freebsd.dk/Gnats
Approved by:	phk
This commit is contained in:
Murray Stokely 2001-10-29 01:58:12 +00:00
parent ebeb66a676
commit 16c51f9fbc
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/www/; revision=11062
5 changed files with 162 additions and 0 deletions

15
tools/prstats/Makefile Normal file
View file

@ -0,0 +1,15 @@
#
# $FreeBSD$
#
all:
./go.tcl
./eval.tcl
make copy
copy:
./cut.tcl 365 __ __365
./cut.tcl 30 __ __30
./cut.tcl 7 __ __7
./cut.tcl 1 __ __1
/usr/local/bin/gnuplot g

15
tools/prstats/cut.tcl Executable file
View file

@ -0,0 +1,15 @@
#!/usr/local/bin/tclsh8.3
#
# $FreeBSD$
#
set t [clock seconds]
set t0 [expr $t - [lindex $argv 0] * 86400]
set fi [open [lindex $argv 1]]
set fo [open [lindex $argv 2] w]
while {[gets $fi a] >= 0} {
if {[lindex $a 2] > $t0} {
puts $fo $a
}
}

33
tools/prstats/eval.tcl Executable file
View file

@ -0,0 +1,33 @@
#!/usr/local/bin/tclsh8.3
#
# $FreeBSD$
#
set fi [open "|sort -n _"]
set fo [open "__" w]
set v {open feedback analyzed suspended closed }
foreach i $v {
set $i 0
}
set m 0
while {[gets $fi a] >= 0} {
if {![regexp {^[0-9]*$} [lindex $a 1]]} {
puts "Bogus: $a"
continue
}
if {[catch {eval [string tolower [lindex $a 2]]}]} {
puts $a
}
if {[lindex $a 1] > $m} {
set m [lindex $a 1].0
}
puts -nonewline $fo [clock format [lindex $a 0] -format "%Y/%m/%d %H:%M" -gmt true]
puts -nonewline $fo " [lindex $a 0]"
foreach i $v {
set j [set $i]
#puts -nonewline $fo " [expr $j / $m]"
puts -nonewline $fo " $j"
}
puts $fo ""
}

56
tools/prstats/g Normal file
View file

@ -0,0 +1,56 @@
# $FreeBSD$
#
set term png small color
set xdata time
set timefmt "%Y/%m/%d %H:%M"
set data style line
set grid
set key left
set output "gnats.png"
set format x "%Y"
plot '__' using 1:4 title "open", \
'__' using 1:5 title "feedback", \
'__' using 1:6 title "analyzed" , \
'__' using 1:7 title "suspended"
set output "gnats1.png"
set format x "%H:%M"
plot '__1' using 1:4 title "open" with linespo, \
'__1' using 1:5 title "feedback", \
'__1' using 1:6 title "analyzed" , \
'__1' using 1:7 title "suspended"
set output "gnats1r.png"
plot '__1' using 1:4 title "open" with linespo
set output "gnats7.png"
set format x "%m/%d"
plot '__7' using 1:4 title "open", \
'__7' using 1:5 title "feedback", \
'__7' using 1:6 title "analyzed" , \
'__7' using 1:7 title "suspended"
set output "gnats7r.png"
plot '__7' using 1:4 title "open"
set output "gnats30.png"
set format x "%Y/%m/%d"
plot '__30' using 1:4 title "open", \
'__30' using 1:5 title "feedback", \
'__30' using 1:6 title "analyzed" , \
'__30' using 1:7 title "suspended"
set output "gnats30r.png"
plot '__30' using 1:4 title "open"
set output "gnats365.png"
set format x "%Y/%m/%d"
plot '__365' using 1:4 title "open", \
'__365' using 1:5 title "feedback", \
'__365' using 1:6 title "analyzed" , \
'__365' using 1:7 title "suspended"
set output "gnats365r.png"
plot '__365' using 1:4 title "open"

43
tools/prstats/go.tcl Executable file
View file

@ -0,0 +1,43 @@
#!/usr/local/bin/tclsh8.3
#
# $FreeBSD$
#
set fo [open _ w]
proc PR {fn} {
global fo
set n [lrange [split $fn /] end end]
set fi [open $fn]
while {[gets $fi a] >= 0} {
if {[string range $a 0 12] == "State-Changed"} {
if {[lindex $a 0] == "State-Changed-When:"} {
set t [clock scan [lrange $a 1 end]]
#puts "* $t"
}
if {[lindex $a 0] == "State-Changed-From-To:"} {
regsub {\->*[ ]*} [lrange $a 1 end] { } d
set b [lindex $d 1]
set c [lindex $d 0]
if {$b == "" || $c == ""} {
puts stderr "$n <$a> <$d> <$b> <$c>"
break
}
#puts "* - $c + $b"
}
if {[lindex $a 0] == "State-Changed-Why:"} {
puts $fo "$t $n {incr $c -1 ; incr $b}"
}
} elseif {[string range $a 0 13] == ">Arrival-Date:"} {
#puts "* $a"
puts $fo "[clock scan [lrange $a 1 end]] $n {incr open}"
} else {
#puts $a
}
}
close $fi
}
foreach pr [glob {/c/gnats/*/[1-9]*}] {
PR $pr
}