Package com.sun.appserv.management.base

Examples of com.sun.appserv.management.base.Sample


      {
        conn.isRegistered( delegateObjectName );
      }
      printPerf( "Time to call MBeanServerConnection.isRegistered() " + ITER + " times: " + (now() - start) + " ms" );
     
      final Sample  sample  = (Sample)getDomainRoot().getContainee( XTypes.SAMPLE );

            final int BANDWIDTH_ITER = 3;
           
            for ( int i = 0; i < BANDWIDTH_ITER; ++i )
            {
                // test upload bandwidth
                final byte[]  uploadBytes  = new byte[ 1 * MB ];
                final long  uploadStart  = now();
                sample.uploadBytes( uploadBytes );
                final long  uploadElapsed  = now() - uploadStart;
                final int  uploadKBPerSec  = (int)((uploadBytes.length / 1024.0) / (uploadElapsed / 1000.0));
                printPerf( "Upload bandwidth (" + uploadBytes.length + " bytes): " + uploadKBPerSec + "kb/sec" );
               
                // test download bandwidth
                final long      downloadStart  = now();
                final byte[]  downloadedBytes  = sample.downloadBytes( 256 * K );
                final long  downloadElapsed  = now() - downloadStart;
                final int  downloadKBPerSec  = (int)((downloadedBytes.length / 1024.0) / (downloadElapsed / 1000.0));
                printPerf( "Download bandwidth (" + uploadBytes.length + " bytes): " + downloadKBPerSec + "kb/sec\n" );
            }
     
View Full Code Here


 
    private void
  testTransferSizePerformance( final MBeanServerConnection conn )
    throws IOException
  {
    final Sample  sample  = (Sample)getDomainRoot().getContainee( XTypes.SAMPLE );
   
        final int   ITER  = 10;
    final int   TEST_SIZE   = 4 * MB;
       
    printPerf( "Upload bandwidth, test size = " + (TEST_SIZE / (float)(MB)) + "MB X " + ITER + " iterations." );
   
    for( int chunkSize = 8 * K; chunkSize <= TEST_SIZE; chunkSize *= 2 )
    {
      final byte[]  chunk  = new byte[ chunkSize ];
     
            long    totalElapsed    = 0;
            for( int iter = 0; iter < ITER; ++iter )
            {
                final long  uploadStart  = now();
                int total   = 0;
                while ( total < TEST_SIZE )
                {
                    sample.uploadBytes( chunk );
                    total   += chunk.length;
                }
                final long  uploadElapsed  = now() - uploadStart;
                totalElapsed    += uploadElapsed;
            }
View Full Code Here

TOP

Related Classes of com.sun.appserv.management.base.Sample

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.