Skip to content

funcmike/swift-coz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Swift Coz (Linux Only)

Coz profiler Swift wrapper/bindings.

This is a Swift wrapper around the Coz profiler here: https://github.com/plasma-umass/coz inspired from https://github.com/urjitbhatia/cozgo (method names, example and this README.md)

Code Usage

Coz Call Equivalent Swift Coz Call Description
COZ_BEGIN("name") cozBegin("name") Begin a latency profiling block identified by the name
COZ_END("name") cozEnd("name") End a latency profiling block identified by the name
COZ_PROGRESS() cozProgress() Specify a progress point within a block of work
COZ_PROGRESS() cozProgressNamed("name") Specify a named progress point within a block of work

For background on causal profiling, see

Paper: http://www.sigops.org/s/conferences/sosp/2015/current/2015-Monterey/printable/090-curtsinger.pdf

Blog: https://morsmachine.dk/causalprof

Running/Usage - Coz works only on Linux

let package = Package(
  name: "SomePackage",
  dependencies: [
    .package(
      url: "https://github.com/funcmike/swift-coz.git", .branch("main")
    )
  ],
  targets: [
    .executableTarget(
      name: "SomeTarget",
      dependencies: [
        .product(name: "Coz", package: "swift-coz"),
      ]
    ),
  ]
  • Import Swift Coz: import Coz
  • Call the Coz wrappers in your application
  • Build your swift binary with debug symbols: swift build -c debug and Check directory with binary: swift build -c debug --show-bin-path
  • Run your application with Coz: coz run --- /path/to/yourSwiftBinary
  • Let the application run for a while (you might want to run some load test etc, so that the profiler can pick up usage data)
  • By default, Coz will create a file called profile.coz
  • Use the Coz viewer to analyze the profile (run: node's http-server in viewer directory of Coz repository https://github.com/plasma-umass/coz)

About

Coz profiler Swift wrapper/bindings

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published