Platform detection for bundled native agent binaries.
Provides functions to detect the current operating system and architecture, mapping them to canonical platform identifiers used for locating bundled native libraries.
Supported platforms:
Returns nil for unsupported platforms to enable graceful degradation.
Platform detection for bundled native agent binaries. Provides functions to detect the current operating system and architecture, mapping them to canonical platform identifiers used for locating bundled native libraries. Supported platforms: - linux-x64: Linux on x86-64 architecture - macos-x64: macOS on x86-64 architecture - macos-arm64: macOS on ARM64 architecture (Apple Silicon) Returns nil for unsupported platforms to enable graceful degradation.
(detect)Detect the current platform and return its canonical identifier.
Returns a string like 'linux-x64' or 'macos-x64', or nil if the platform is not supported.
The detection uses System properties:
Example:
(detect)
;=> "macos-x64"
Detect the current platform and return its canonical identifier. Returns a string like 'linux-x64' or 'macos-x64', or nil if the platform is not supported. The detection uses System properties: - os.name: Operating system name - os.arch: System architecture Example: ```clojure (detect) ;=> "macos-x64" ```
(extension platform)Return the native library file extension for the given platform.
Parameters:
Returns the file extension ('so' or 'dylib') or nil if the platform is not recognized.
Example:
(extension "macos-x64")
;=> "dylib"
Return the native library file extension for the given platform.
Parameters:
- platform: A platform identifier string (e.g., 'linux-x64', 'macos-x64')
Returns the file extension ('so' or 'dylib') or nil if the platform
is not recognized.
Example:
```clojure
(extension "macos-x64")
;=> "dylib"
```(resource-path platform)Return the resource path for the agent binary on the given platform.
Parameters:
Returns a path string like 'criterium/agent/macos-x64/libcriterium.dylib' or nil if the platform is not supported.
Example:
(resource-path "macos-x64")
;=> "criterium/agent/macos-x64/libcriterium.dylib"
Return the resource path for the agent binary on the given platform. Parameters: - platform: A platform identifier string (e.g., 'linux-x64', 'macos-x64') Returns a path string like 'criterium/agent/macos-x64/libcriterium.dylib' or nil if the platform is not supported. Example: ```clojure (resource-path "macos-x64") ;=> "criterium/agent/macos-x64/libcriterium.dylib" ```
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |