|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectfiftyone.device.example.illustration.Benchmark
public class Benchmark
Example of a Benchmarking tool using 51Degrees Pattern detection to stress test your system.
The Example takes three arguments in the form of the 51Degrees binary device data file path, the path of a .csv file containing User-Agents to be matched and the number of threads you want to use for detection (optional where the default is the number or logical cores in your current system. The Example tests three different memory profiles: stream memory, stream file and memory modes.
long start = System.nanoTime();
bm.provider.match(userAgentString, match);
bm.elapsedNano.addAndGet(
System.nanoTime() - start);
bm.provider.dataSet.getProperties()) {
Values values = match.getValues(property);
if (values != null) {
workerCheckSum += values.toStringArray().length;
} *
main(java.lang.String[]) to test the performance of your system.
| Constructor Summary | |
|---|---|
Benchmark(String userAgentFile)
Initialises the device detection Provider with the included Lite data file. |
|
| Method Summary | |
|---|---|
protected static byte[] |
fileAsBytes(String deviceDataFile)
|
double |
getAverageDetectionTimePerThread()
|
int |
getCount()
|
static void |
main(String[] args)
Instantiates this class and starts runBenchmarks(String, String, int) with parameters from the
command line. |
void |
run(Dataset dataSet,
int numberOfThreads)
Reads a CSV file containing User-Agents performing detection on each one using the provider. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Benchmark(String userAgentFile)
throws IOException,
IllegalArgumentException
userAgentFile -
IOException - if there was a problem reading from the data file.
IllegalArgumentException| Method Detail |
|---|
public double getAverageDetectionTimePerThread()
public int getCount()
public void run(Dataset dataSet,
int numberOfThreads)
throws IOException,
InterruptedException
dataSet - to be used for the benchmark.numberOfThreads -
IOException - if there was a problem reading from the data file.
InterruptedException
protected static byte[] fileAsBytes(String deviceDataFile)
throws IOException
IOException
public static void main(String[] args)
throws IOException,
InterruptedException
runBenchmarks(String, String, int) with parameters from the
command line.
args - command line arguments.
IOException
InterruptedException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||