metrictest.java revision f5e435b10a89c4311d503faa10e79e736dfcc976
/*
* Sample of performance API usage, written in Java.
*
* Don't forget to run VBOX webserver
* with 'vboxwebsrv -t 1000' command, to calm down watchdog thread.
*
* Copyright (C) 2008-2009 Sun Microsystems, Inc.
*
* The following license applies to this file only:
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*/
class PerformanceData
{
public Long sequenceNumber;
public String getFormattedSamples()
{
if (scale != 1)
{
{
separator = ", ";
}
}
else
{
{
separator = ", ";
}
}
out += "]";
return out;
}
}
class PerformanceCollector
{
private IVirtualBox _vbox;
private IPerformanceCollector _collector;
{
}
public void cleanup()
{
}
public List<IPerformanceMetric> setup(List<String> metricNames, List<IUnknown> objects, Long period, Long samples)
{
}
{
}
{
}
{
{
{
}
}
return data;
}
}
public class metrictest implements Runnable
{
public metrictest()
{
}
{
try
{
return machineName;
} catch (Exception e)
{
}
return new String("host");
}
public void setup()
{
}
public void collect()
{
try
{
{
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
public void run()
{
// Clean up
try
{
{
}
{
}
}
catch (Exception e)
{
e.printStackTrace();
}
}
{
metrictest c = new metrictest();
// Add a shutdown handle to clean up
// Start metric collection
c.setup();
// Obtain and print out stats continuosly until ctrl-C is pressed
while (true)
{
c.collect();
}
}
}