Skip to content
This repository has been archived by the owner on Apr 11, 2024. It is now read-only.

Commit

Permalink
benchmark: Add os detect for engines running in Java. [jddalton]
Browse files Browse the repository at this point in the history
  • Loading branch information
jdalton committed Dec 21, 2010
1 parent 7ab1148 commit 3edc80b
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 31 deletions.
10 changes: 6 additions & 4 deletions benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -1292,14 +1292,16 @@
}
else if (typeof process == 'object' && process) {
name = 'Node.js';
version = /[\d.]+/.exec(data.version)[0];
version = /[\d.]+/.exec(process.version)[0];
os = process.platform;
}
os = os && (os.charAt(0).toUpperCase() + os.slice(1));
}
else if (isClassOf(me.environment, 'Environment')) {
} else if (isClassOf(me.environment, 'Environment')) {
name = 'Rhino';
}
if (IN_JAVA && !os) {
os = String(java.lang.System.getProperty('os.name'));
}
os = os && (os.charAt(0).toUpperCase() + os.slice(1));
}
// detect non Safari WebKit based browsers
else if (product && (!name || name == 'Safari' && !/^iP/.test(product))) {
Expand Down
52 changes: 26 additions & 26 deletions docs/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@
* [Benchmark#toString](#toString)

# Benchmark
## <a name="static-CALIBRATIONS" href="../benchmark.js#L1368">Benchmark.CALIBRATIONS</a>
## <a name="static-CALIBRATIONS" href="../benchmark.js#L1370">Benchmark.CALIBRATIONS</a>
*(Array)*: Benchmarks to establish iteration overhead. <sub>[&not;][1]</sub>

## <a name="static-platform" href="../benchmark.js#L1226">Benchmark.platform</a>
*(Boolean)*: Platform object containing browser name, version, and operating system. <sub>[&not;][1]</sub>

## <a name="static-version" href="../benchmark.js#L1383">Benchmark.version</a>
## <a name="static-version" href="../benchmark.js#L1385">Benchmark.version</a>
*(String)*: The version number. <sub>[&not;][1]</sub>

## <a name="static-each" href="../benchmark.js#L372">Benchmark.each(array, callback)</a>
Expand Down Expand Up @@ -232,76 +232,76 @@ A generic bare-bones String#trim solution. <sub>[&not;][1]</sub>


# Benchmark.prototype
## <a name="CALIBRATION_INDEX" href="../benchmark.js#L1452">Benchmark#CALIBRATION_INDEX</a>
## <a name="CALIBRATION_INDEX" href="../benchmark.js#L1454">Benchmark#CALIBRATION_INDEX</a>
*(Number)*: The index of the calibration benchmark to use when computing results. <sub>[&not;][1]</sub>

## <a name="CYCLE_DELAY" href="../benchmark.js#L1459">Benchmark#CYCLE_DELAY</a>
## <a name="CYCLE_DELAY" href="../benchmark.js#L1461">Benchmark#CYCLE_DELAY</a>
*(Number)*: The delay between test cycles *(secs)*. <sub>[&not;][1]</sub>

## <a name="DEFAULT_ASYNC" href="../benchmark.js#L1466">Benchmark#DEFAULT_ASYNC</a>
## <a name="DEFAULT_ASYNC" href="../benchmark.js#L1468">Benchmark#DEFAULT_ASYNC</a>
*(Boolean)*: A flag to indicate methods will run asynchronously by default. <sub>[&not;][1]</sub>

## <a name="DETECT_INFINITY" href="../benchmark.js#L1473">Benchmark#DETECT_INFINITY</a>
## <a name="DETECT_INFINITY" href="../benchmark.js#L1475">Benchmark#DETECT_INFINITY</a>
*(Boolean)*: A flag to indicate protection against large run counts if Infinity ops/sec is detected. <sub>[&not;][1]</sub>

## <a name="INIT_RUN_COUNT" href="../benchmark.js#L1480">Benchmark#INIT_RUN_COUNT</a>
## <a name="INIT_RUN_COUNT" href="../benchmark.js#L1482">Benchmark#INIT_RUN_COUNT</a>
*(Number)*: The default number of times to execute a test on a benchmark's first cycle. <sub>[&not;][1]</sub>

## <a name="MAX_TIME_ELAPSED" href="../benchmark.js#L1487">Benchmark#MAX_TIME_ELAPSED</a>
## <a name="MAX_TIME_ELAPSED" href="../benchmark.js#L1489">Benchmark#MAX_TIME_ELAPSED</a>
*(Number)*: The maximum time a benchmark is allowed to run before finishing *(secs)*. <sub>[&not;][1]</sub>

## <a name="MIN_TIME" href="../benchmark.js#L1494">Benchmark#MIN_TIME</a>
## <a name="MIN_TIME" href="../benchmark.js#L1496">Benchmark#MIN_TIME</a>
*(Number)*: The time needed to reduce the percent uncertainty of measurement to `1`% *(secs)*. <sub>[&not;][1]</sub>

## <a name="MoE" href="../benchmark.js#L1501">Benchmark#MoE</a>
## <a name="MoE" href="../benchmark.js#L1503">Benchmark#MoE</a>
*(Number)*: The margin of error. <sub>[&not;][1]</sub>

## <a name="RME" href="../benchmark.js#L1508">Benchmark#RME</a>
## <a name="RME" href="../benchmark.js#L1510">Benchmark#RME</a>
*(Number)*: The relative margin of error *(expressed as a percentage of the mean)*. <sub>[&not;][1]</sub>

## <a name="SD" href="../benchmark.js#L1515">Benchmark#SD</a>
## <a name="SD" href="../benchmark.js#L1517">Benchmark#SD</a>
*(Number)*: The sample standard deviation. <sub>[&not;][1]</sub>

## <a name="SEM" href="../benchmark.js#L1522">Benchmark#SEM</a>
## <a name="SEM" href="../benchmark.js#L1524">Benchmark#SEM</a>
*(Number)*: The standard error of the mean. <sub>[&not;][1]</sub>

## <a name="aborted" href="../benchmark.js#L1557">Benchmark#aborted</a>
## <a name="aborted" href="../benchmark.js#L1559">Benchmark#aborted</a>
*(Boolean)*: A flag to indicate if the benchmark is aborted. <sub>[&not;][1]</sub>

## <a name="count" href="../benchmark.js#L1529">Benchmark#count</a>
## <a name="count" href="../benchmark.js#L1531">Benchmark#count</a>
*(Number)*: The number of times a test was executed. <sub>[&not;][1]</sub>

## <a name="cycles" href="../benchmark.js#L1536">Benchmark#cycles</a>
## <a name="cycles" href="../benchmark.js#L1538">Benchmark#cycles</a>
*(Number)*: The number of cycles performed while benchmarking. <sub>[&not;][1]</sub>

## <a name="error" href="../benchmark.js#L1543">Benchmark#error</a>
## <a name="error" href="../benchmark.js#L1545">Benchmark#error</a>
*(Object|Null)*: The error object if the test failed. <sub>[&not;][1]</sub>

## <a name="hz" href="../benchmark.js#L1550">Benchmark#hz</a>
## <a name="hz" href="../benchmark.js#L1552">Benchmark#hz</a>
*(Number)*: The number of executions per second. <sub>[&not;][1]</sub>

## <a name="persist" href="../benchmark.js#L1564">Benchmark#persist</a>
## <a name="persist" href="../benchmark.js#L1566">Benchmark#persist</a>
*(Boolean)*: A flag to indicate if results persist for the browser session. <sub>[&not;][1]</sub>

## <a name="running" href="../benchmark.js#L1571">Benchmark#running</a>
## <a name="running" href="../benchmark.js#L1573">Benchmark#running</a>
*(Boolean)*: A flag to indicate if the benchmark is running. <sub>[&not;][1]</sub>

## <a name="times" href="../benchmark.js#L1578">Benchmark#times</a>
## <a name="times" href="../benchmark.js#L1580">Benchmark#times</a>
*(Object)*: An object of timing data including cycle, elapsed, period, start, and stop. <sub>[&not;][1]</sub>

## <a name="cycle" href="../benchmark.js#L1585">Benchmark#times.cycle</a>
## <a name="cycle" href="../benchmark.js#L1587">Benchmark#times.cycle</a>
*(Number)*: The time taken to complete the last cycle *(secs)* <sub>[&not;][1]</sub>

## <a name="elapsed" href="../benchmark.js#L1592">Benchmark#times.elapsed</a>
## <a name="elapsed" href="../benchmark.js#L1594">Benchmark#times.elapsed</a>
*(Number)*: The time taken to complete the benchmark *(secs)*. <sub>[&not;][1]</sub>

## <a name="period" href="../benchmark.js#L1599">Benchmark#times.period</a>
## <a name="period" href="../benchmark.js#L1601">Benchmark#times.period</a>
*(Number)*: The time taken to execute the test once *(secs)*. <sub>[&not;][1]</sub>

## <a name="start" href="../benchmark.js#L1606">Benchmark#times.start</a>
## <a name="start" href="../benchmark.js#L1608">Benchmark#times.start</a>
*(Number)*: A timestamp of when the benchmark started *(ms)*. <sub>[&not;][1]</sub>

## <a name="stop" href="../benchmark.js#L1613">Benchmark#times.stop</a>
## <a name="stop" href="../benchmark.js#L1615">Benchmark#times.stop</a>
*(Number)*: A timestamp of when the benchmark finished *(ms)*. <sub>[&not;][1]</sub>

## <a name="abort" href="../benchmark.js#L797">Benchmark#abort()</a>
Expand Down
3 changes: 2 additions & 1 deletion tests/tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ test("user agent detection", function() {
.replace(/\bwindow\b/g, 'me')
.replace(/\bexports\b/g, 'me.exports')
.replace(/([^.\x22\x27])global\b/g, '$1me.global')
.replace(/\bprocess\b/g, 'me.process')
.replace(/\bsystem\b/g, 'me.system')
.replace(/\bEnvironment\b/g, 'Object')
.replace(/\bnav\.appMinorVersion/g, 'me.appMinorVersion')
.replace(/\b(?:me\.)?external/g, 'me.external')
.replace(/\bexternal/g, 'me.external')
.replace(/\bdoc\.documentMode/g, 'me.mode'));
}
});
Expand Down

0 comments on commit 3edc80b

Please sign in to comment.