netapp
Class Client

java.lang.Object
  extended by netapp.Client

public class Client
extends java.lang.Object

A Client is what we'd think of as the typical program. In this case, the program doesn't do very much -- it just reads from a source and copies what it gets to a sink. That is, it does more or less what the *nix command 'cat' does.

There is somewhat more machinery in the code you'll find here than that requires, but you should ignore it. It has to do with reliably running repeated executions of the Client while trying to minimize the impact of Java on the results. The essence of a Client is simply "while my source has data, read it and write it to my sink."

Version:
$Id: Client.java,v 1.15 2010/01/06 02:18:56 zahorjan Exp $

Field Summary
private  byte[] buf
           
private static int BUFSIZE
           
 long bytesSent
          Used to compute timing statistics only.
 long elapsedTime
          Used to compute timing statistics only.
(package private)  StopWatch watch
          Used for statistics keeping.
 
Constructor Summary
Client()
          Constructor: creates long-lived instance variables.
 
Method Summary
 void go(DataSource src, datasink.DataSink sink)
          Run the Client.
static void main(java.lang.String[] args)
          main() handles the command line arguments, meaning it sets up the src and sink for the Client object.
private static void printStats(int nTrials, long elapsedTime, long totalBytesSent, long totalElapsedTime)
          Helper function to print some statistics.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elapsedTime

public long elapsedTime
Used to compute timing statistics only.


bytesSent

public long bytesSent
Used to compute timing statistics only.


BUFSIZE

private static final int BUFSIZE
See Also:
Constant Field Values

buf

private byte[] buf

watch

StopWatch watch
Used for statistics keeping.

Constructor Detail

Client

public Client()
Constructor: creates long-lived instance variables.

Method Detail

go

public void go(DataSource src,
               datasink.DataSink sink)
Run the Client. All it does is copy from its src to its sink.


printStats

private static void printStats(int nTrials,
                               long elapsedTime,
                               long totalBytesSent,
                               long totalElapsedTime)
Helper function to print some statistics.


main

public static void main(java.lang.String[] args)
main() handles the command line arguments, meaning it sets up the src and sink for the Client object. It runs as many repetitions of the experiment as it can in a roughly fixed amount of time.