public static void main ( String [ ] args ) throws Exception { NormalAlphabet na = new NormalAlphabet ( ) ; SAXProcessor sp = new SAXProcessor ( ) ; String dataFileName = args [ 0 ] ; System . out . println ( "data file: " + dataFileName ) ; double [ ] ts = TSProcessor . readFileColumn ( dataFileName , 0 , 0 ) ; System . out . println ( "data size: " + ts . length ) ; System . out . println ( "SAX parameters:\n sliding window sizes: " + Arrays . toString ( WINDOWS ) + "\n PAA sizes: " + Arrays . toString ( PAAS ) + "\n alphabet sizes: " + Arrays . toString ( ALPHABETS ) + "\n NR strategis: " + Arrays . toString ( NRS ) ) ; System . out . println ( "Performing " + NRUNS + " SAX conversion runs for each algorithm implementation ... " ) ; // conventional // long tstamp1 = System . currentTimeMillis ( ) ; for ( int slidingWindowSize : WINDOWS ) { for ( int paaSize : PAAS ) { for ( int alphabetSize : ALPHABETS ) { for ( String nrStrategy : NRS ) { for ( int i = 0 ; i < NRUNS ; i ++ ) { @ SuppressWarnings ( "unused" ) SAXRecords sequentialRes = sp . ts2saxViaWindow ( ts , slidingWindowSize , paaSize , na . getCuts ( alphabetSize ) , NumerosityReductionStrategy . fromString ( nrStrategy ) , N_THRESHOLD ) ; } } } } } long tstamp2 = System . currentTimeMillis ( ) ; System . out . println ( "single thread conversion: " + String . valueOf ( tstamp2 - tstamp1 ) + ", " + SAXProcessor . timeToString ( tstamp1 , tstamp2 ) ) ; // parallel for ( int threadsNum = MIN_CPUS ; threadsNum < MAX_CPUS ; threadsNum ++ ) { tstamp1 = System . currentTimeMillis ( ) ; for ( int slidingWindowSize : WINDOWS ) { for ( int paaSize : PAAS ) { for ( int alphabetSize : ALPHABETS ) { for ( String nrStrategy : NRS ) { for ( int i = 0 ; i < NRUNS ; i ++ ) { ParallelSAXImplementation ps = new ParallelSAXImplementation ( ) ; @ SuppressWarnings ( "unused" ) SAXRecords parallelRes = ps . process ( ts , threadsNum , slidingWindowSize , paaSize , alphabetSize , NumerosityReductionStrategy . fromString ( nrStrategy ) , N_THRESHOLD ) ; } } } } } tstamp2 = System . currentTimeMillis ( ) ; System . out . println ( "parallel conversion using " + threadsNum + " threads: " + String . valueOf ( tstamp2 - tstamp1 ) + ", " + SAXProcessor . timeToString ( tstamp1 , tstamp2 ) ) ; } }
Runs the evaluation .