### Benchmarking with Progress Reporting Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/readme Wrap your benchmark calls with `with-progress-reporting` to see progress information on *out*. This example shows it with both `bench` and `quick-bench`. ```clojure (with-progress-reporting (bench (Thread/sleep 1000) :verbose)) (with-progress-reporting (quick-bench (Thread/sleep 1000) :verbose)) ``` -------------------------------- ### Basic Benchmarking with `bench` Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/readme Use the `bench` function to measure the computation time of an expression. This example benchmarks a 1-second sleep. ```clojure (bench (Thread/sleep 1000)) ``` -------------------------------- ### Create Resource Directories Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Creates the necessary directory structure to store the downloaded native agent binaries and their corresponding SHA256 hash files. These directories follow a specific platform-based convention. ```bash mkdir -p bases/agent/resources/native/linux-x64 mkdir -p bases/agent/resources/native/macos-x64 mkdir -p bases/agent/resources/native/macos-arm64 ``` -------------------------------- ### Lower-Level Benchmarking Functions Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/readme Use `benchmark` and `quick-benchmark` for more control, then `report-result` to display the statistics. The `:verbose true` option provides detailed output. ```clojure (report-result (benchmark (Thread/sleep 1000) {:verbose true})) (report-result (quick-benchmark (Thread/sleep 1000))) ``` -------------------------------- ### Copy Binaries to Resource Paths Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Copies the downloaded agent binaries and their SHA256 hash files from the artifact directories into the designated resource paths. This ensures the agent is correctly placed for runtime loading. ```bash cp agent-cpp-linux-x64/libcriterium.* bases/agent/resources/native/linux-x64/ cp agent-cpp-macos-x64/libcriterium.* bases/agent/resources/native/macos-x64/ cp agent-cpp-macos-arm64/libcriterium.* bases/agent/resources/native/macos-arm64/ ``` -------------------------------- ### Load Local Agent Build with Clojure Aliases Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Use these Clojure aliases to configure the JVM to load the locally built agent from the `agent-cpp/` directory instead of using bundled binaries. ```bash # Use :with-agent-* aliases to load local build clojure -M:dev:with-agent-mac # macOS clojure -M:dev:with-agent-linux # Linux ``` -------------------------------- ### Run Tests with Bundled Agent Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Executes the project's test suite using the bundled C++ agent. This command ensures that the agent is correctly integrated and functional. ```bash clojure -M:kaocha:dev:test --reporter dots ``` -------------------------------- ### Download macOS Agent Artifacts Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Downloads the agent artifacts for both macOS x64 and macOS ARM64 architectures from a specific GitHub Actions run. Each download creates a directory with the respective binaries. ```bash gh run download -n agent-cpp-macos-x64 gh run download -n agent-cpp-macos-arm64 ``` -------------------------------- ### Build Agent Locally (Linux/macOS) Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Build the C agent locally from the agent-cpp directory. This is useful for development with local agent modifications. Use the `CMAKE_BUILD_TYPE=Debug` flag to build with debug symbols. ```bash cd agent-cpp cmake -B build cmake --build build ``` ```bash # Build with debug symbols cmake -B build -DCMAKE_BUILD_TYPE=Debug cmake --build build ``` -------------------------------- ### Test Agent Loading in REPL Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Interactively tests if the Criterium agent has been loaded successfully by evaluating a specific function in the Clojure REPL. This is a quick way to verify agent integration. ```clojure (require 'criterium.agent) (criterium.agent/loaded?) ``` -------------------------------- ### Download Linux Agent Artifact Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Downloads the agent artifact for the Linux x64 platform from a specific GitHub Actions run. This artifact contains the shared library and its SHA256 hash. ```bash gh run download -n agent-cpp-linux-x64 ``` -------------------------------- ### Cross-Compile macOS Agent Binaries Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Cross-compile macOS agent binaries for specific architectures using CMake and the `CMAKE_OSX_ARCHITECTURES` variable. This allows building both x86_64 and ARM64 binaries from a single runner. ```bash # Build for specific architecture cmake -B build -DCMAKE_OSX_ARCHITECTURES=x86_64 # Intel Macs cmake --build build ``` ```bash cmake -B build -DCMAKE_OSX_ARCHITECTURES=arm64 # Apple Silicon cmake --build build ``` -------------------------------- ### Add Criterium Dependency (Leiningen) Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/readme Add this to your project's :dependencies in your project.clj file to include Criterium. ```clojure [criterium "0.4.6"] ``` -------------------------------- ### List Recent Workflow Runs Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/building-and-updating-the-c-agent Use this command to list the most recent runs of the agent-cpp.yml workflow. This helps in identifying the correct run ID for downloading artifacts. ```bash gh run list --workflow="agent-cpp.yml" --limit 5 ``` -------------------------------- ### Merge develop into master Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/releasing-criterium Before performing a release, merge the develop branch into the master branch and push the changes. ```bash git checkout master git pull origin master git merge develop git push origin master ``` -------------------------------- ### Add Criterium Dependency (Maven) Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/readme Include this dependency in your Maven project's pom.xml file. ```xml criterium criterium 0.4.6 ``` -------------------------------- ### Require Criterium Core Namespace Source: https://cljdoc.org/d/criterium/criterium/0.5.243-ALPHA/doc/readme Use this statement at the beginning of your Clojure file to access Criterium's core functions. ```clojure (use 'criterium.core) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.