Now I create a hash with the key values equal to a the generalized timestamp. This lets me see how many unique sessions were active during a given 15 minute interval:for($date){ ($h,$m,$s)=split/:/; s/\:\d\d$//; #throw out the seconds, we don't need them $m="00" if ($m<15); $m="15" if (($m>=15) && ($m<30)); $m="30" if (($m>=30) && ($m<45)); $m="45" if ($m>=45); s/\:\d\d\/\:$m/; #replace the minutes with the generalized value }
Now I have a hash with keys equal to 15 minute interval timestamps and values equal to the number of unique sessions active during the interval. I then create the graph:$parseddata{$date}++ unless grep{$_ eq "$date|$session"}@seen; push @seen,"$date|$session";
my @keys = sort keys %parseddata; my @values; for(@keys){ push @values,$parseddata{$_}; } my @data=([@keys],[@values]); my $graph=GD::Graph::area->new(1000,600); #set all the graph options(labels, colors etc...) my $gd = $graph->plot(\@data); open(GRAPH, ">/graphs/$datestamp.png) or die "Can't open output file f +or graph: $!"; binmode GRAPH; print GRAPH $gd->png;
In reply to Re: How to do session times The Right Way
by insensate
in thread How to do session times The Right Way
by strider corinth
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |