Skip to content

Instantly share code, notes, and snippets.

@kgorman
Created August 12, 2010 18:51
Show Gist options
  • Save kgorman/521481 to your computer and use it in GitHub Desktop.
Save kgorman/521481 to your computer and use it in GitHub Desktop.
public static void query()
throws Exception {
db.getLastError(2,2,false); // make sure socket is clear
List<Thread> all = new ArrayList<Thread>();
for ( int i=0; i<NUM_THREADS; i++ )
all.add( new Runner() );
long start = System.currentTimeMillis();
int before = UPTO.get();
for ( Thread t : all )
t.start();
for ( Thread t : all )
t.join();
long end = System.currentTimeMillis();
int after = UPTO.get();
System.out.println( "queries/sec: " + ( 1000.0 * ( after-before) / ( end - start ) ));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment