\r\n

51Degrees Device Detection Java  4.4

Device detection services for 51Degrees Pipeline

fiftyone.devicedetection.examples.console.comparison.Comparer Class Reference

Detailed Description

This class provides a framework and runner for comparing different device detection solutions.

It is provided in a basic form to compare detection time. Different solutions may be compared by implementing the interfaces in Detection. In this example we have provided such implementations for 51Degrees and BrowsCap, and skeleton commented-out implementations for ScientiaMobile (WURFL) and DeviceAtlas. We don't have access to those APIs so the code has not been tested and it is left to those interested to uncomment and get working.

Collaboration diagram for fiftyone.devicedetection.examples.console.comparison.Comparer:

[legend]

Classes

class  Benchmark
Implementation of the benchmark for a single thread.
class  ExecutionResult
A list of BenchmarkResult, one per thread, and the elapsed time between starting the threads and them all completing.

Public Member Functions

void  compare (List< Solution > solutions, int numberOfThreads, int numberOfResults, Reporting reportingModel, PrintWriter writer) throws Exception
Execute the benchmarks using the solutions provided. More...
List< BenchmarkResult >  runBenchmarks (Solution solution) throws Exception
Initiate the benchmark threads. More...

Static Public Member Functions

static void  main (String[] args) throws Exception

Static Public Attributes

static final int  DEFAULT_NUMBER_OF_THREADS = 4
static final int  DEFAULT_NUMBER_OF_RESULTS = 2500
static final Solution []  DEFAULT_SOLUTIONS

Member Function Documentation

◆ compare()

void fiftyone.devicedetection.examples.console.comparison.Comparer.compare ( List< Solution >   solutions,
int   numberOfThreads,
int   numberOfResults,
Reporting   reportingModel,
PrintWriter   writer  
) throws Exception

Execute the benchmarks using the solutions provided.

Parameters
solutions - some solutions
numberOfThreads - how many threads to run for each solution
numberOfResults - how many detections to do per thread
reportingModel - how and what to report
writer - where to report it
Exceptions
Exception - to satisfy underlying APIs

◆ runBenchmarks()

List<BenchmarkResult> fiftyone.devicedetection.examples.console.comparison.Comparer.runBenchmarks ( Solution   solution ) throws Exception

Initiate the benchmark threads.

Parameters
solution - the solution being benchmarked
Returns
result of the benchmark
Exceptions
Exception - to satisfy called APIs

Member Data Documentation

◆ DEFAULT_SOLUTIONS

final Solution [] fiftyone.devicedetection.examples.console.comparison.Comparer.DEFAULT_SOLUTIONS
static
Initial value:
= {
new DetectionImplFiftyOneDegrees.FiftyOneSolution(),
new DetectionImplBrowsCap.BrowsCapSolution()}