Giter VIP home page Giter VIP logo

zig-tracy-fork's Introduction

Zig tracy client

Easy to use bindings for the tracy client C API.

Dependencies

  • Zig 0.12.0-dev.1664+8ca4a5240
  • Tracy 0.10.0 (only for viewing the profiling session, this repository is only concerned with client matters)

Features

  • Designed to integrate well with build.zig
  • Builds and statically links the tracy client - perfect for cross-compilation
  • Uses Zig comptime to nullify the tracy markup when building with tracy disabled
  • Provides Zig friendly bindings for:
    • Zone markup
    • Frame markup
    • Plotting
    • Message printing
    • Memory tracing via custom allocator

Usage

See ./example for how to set up zig-tracy with a Zig project.

In summary:

  • Declare zig-tracy as a dependency in the build.zig.zon
  • Configure zig-tracy dependency in build.zig
  • Instrument the code using the provided Zig module
  • Use Tracy UI/server to connect to the instrumented Zig application and explore the profiler data

Building as a Shared Library

If your project needs to call tracy functions from multiple DLLs, then you need to build the tracy client as a shared library.

This is accomplished by passing the shared option, and (if you're using Windows) installing the resulting shared library next to your exe.

    const tracy = b.dependency("tracy", .{
        .target = target,
        .optimize = optimize,
        .shared = true,
    });

    const install_dir = std.Build.Step.InstallArtifact.Options.Dir{ .override = .{ .bin = {} } };
    const install_tracy = b.addInstallArtifact(tracy.artifact("tracy"), .{
        .dest_dir = install_dir,
        .pdb_dir = install_dir,
    });
    b.getInstallStep().dependOn(&install_tracy.step);

For additional context, see section 2.1.5 of the Tracy manual, "Setup for multi-DLL projects".

Todo / Ideas

  • Figure out why system sampling is broken
  • Tracy fibers support, would make sense paired with Zig async
  • GPU zone markup support
  • Test callstack support

zig-tracy-fork's People

Contributors

cipharius avatar kcbanner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.