ASPerf is an example that demonstrates how to perform timing measurements to calculate how long it takes ActiveSpaces to perform an action.
ASPerf consists of a master and any number of slaves. The master is used to remotely invoke methods on the slaves. Each remote invocation method on a slave times the action being performed and the timings are returned in the results of the remote invocation. The master then displays the results returned from each of the slaves.
The ASPerf example uses two different spaces:
Additionally, each slave creates its own individual space, which the slave can use instead of using the ASPerfShared space that it shares with all of the other slaves. Remote invocations from the master indicate which space a slave should use. In this way, you can see the timing differences between when a slave uses its own local space or uses the shared space in its remote invocation methods.
The ASPerf master creates the
ASPerfCtrl space and then joins it as a leech. Each slave joins the
ASPerfCtrl space as a seeder. In this way, the
ASPerf master can use remote invocation on all seeders to invoke the same remote invocation method on all of the slaves of the
ASPerfCtrl space.
ASPerf slaves can join the
ASPerfShared space or their own local space as seeders or leeches.
Whether a slave joins these spaces as a leech or a seeder is controlled by the command line options of the ASPerf slave. The minimum number of seeders required for the
ASPerfShared space and the
ASPerf slave's own space is one. So if an
ASPerf slave is started as a leech, an
as-agent must also be run so that the slave's own space will have a seeder.
Since an as-agent joins all spaces in a metaspace as a seeder, when the
ASPerf master tries to remotely invoke a method on all seeders of the
ASPerfCtrl space, the remote invocation is also be tried on the
as-agent. Since the
as-agent does not know about the
ASPerf remote invocation methods,
as-agent reports an error back to the
ASPerf master. For this reason, a special version of
as-agent,
ASPerfAgent, is provided with the
ASPerf example.
Similar to as-agent,
ASPerfAgent joins spaces in a metaspace as a seeder and thereby lends its computing resources to the space. However,
ASPerfAgent specifically
does not join the
ASPerfCtrl space. So when the
ASPerf master does remote invocations on all seeders of the
ASPerfCtrl space, the remote invocation is not be tried on the
ASPerfAgent and unnecessary errors are not reported back to the master.
The ASPerf master joins the
ASPerfCtrl space as a leech. When you start the
ASPerf master, you see the following message until an
ASPerf slave is started:
After an ASPerf slave is started, the master continues, and you see the following prompt, which allows you to enter commands to cause the remote invocation of methods on the slaves: