Thursday, September 6, 2012

JASERIES (JAnalyseSeries) 1.3.0 released

JASERIES is a scala API for time numeric series operations. ( ** project page **)

Latest changes :
  • "implicit format:CSVFormat" now correctly used
  • CSVFormat comes with a default implicit format.
  • CSVFormatHints class removed.
  • CSVFormat class and usage refactoring
  • Support for variable columns csv, example with this following csv file :
          date;             A
          20-03-2011 02:00; 2
          20-03-2011 03:00;
          20-03-2011 04:00; 8
          date;             A; B; C
          20-03-2011 05:00; 1; 2; 3
          20-03-2011 06:00; 2;  ; 5
          date;             C; D
          20-03-2011 07:00; 7; 0
      
  • apache commons 1.8.4 dependency added (for bzip2 implementation)
  • gzip, bzip2 compressed csv file now taken into account in fromFile and fromURL methods
        val s0 = CSV2Series.fromURL(
             "http://dnld.crosson.org/modstatus-totalaccesses.csv.bz2")
        val s1 = CSV2Series.fromFile("samples/modstatus-totalaccesses.jxtcsv.gz")
        val s2 = CSV2Series.fromFile("samples/modstatus-totalaccesses.jxtcsv.bz2")
      
  • some TimeModel refactoring + adding a new TimeModel implementation : TimeModelCustom
    But would require some refactoring, performance potential problem I think.
  • package series object added : provides helper functions + align : align some series together on common times they share (using a time normalizer)
  • now supports any order for series computation with numbers : "10 + s" or "s + 10"
    (thanks to an implicit conversion defined in series package objet
  • more test cases
  • series now overrides equals & hashCode (series alias field is not taken into acount - alias is a user friendly series name).
  • series times and values methods return IndexedSeq collection instead of Iterable

Apache total accesses counter to hit rate

The following example demonstrates how to convert a global http hit counter, into a hitrate series:
import fr.janalyse.series._
val csv = CSV2Series.fromURL("http://dnld.crosson.org/modstatus-totalaccesses.csv")
val totalaccesses=csv.values.head

val hitrate=
  totalaccesses
    .delta
    .toSeries[AddCell]
    .sample("10m")
    .toRate()
    .rename("http hit rate")

CSV2Series.toFile(hitrate, "hitrate.csv")

JVM processing time to JVM cpu usage

The following example demonstrates how to convert a java process cpu time counter (mbean : java.lang:type=OperatingSystem__ProcessCpuTime), into a cpu usage metric (here I didn't take into account the number of CPU, so max value = cpu count * 100):
import fr.janalyse.series._
val csv = CSV2Series.fromURL("http://dnld.crosson.org/processcputime.csv")
val cputime=csv.values.head

val cpucells = 
   for(Seq(a,b) <- (cputime / 1000d / 1000d).sliding(2).toIterable ) 
   yield a.time->(b.value-a.value)/(b.time-a.time)*100d

val cpuusage = Series[StatCell]("cpu usage percent", "5m") <<< cpucells

CSV2Series.toFile(cpuusage, "cpuusage.csv")

No comments:

Post a Comment