Giter Site home page Giter Site logo

psh-sdk-wit's Introduction

PSH SDK Wit Project

This project contains wit definitions for developing performance engineering wasm component.

For now there are two main packages, perf and system. perf provides wrappers for the Linux perf APIs to collect Linux perf data, system provides APIs for quering system resources information, i.e., cpus/memory/processes.

These APIs are implemented in PSH project.

How To Use It?

There are a few options available (we recommand git submodule and wit-bindgen):

  1. Add this project as a dependency as your wasm component project, i.e., add this project as a submodule or simply copy/paste these files under your project directory.
    git submodule add [email protected]:OptimatistOpenSource/psh-sdk-wit.git /path/to/psh-sdk-wit
  1. use wit-bindgen or it's command line interface wit-bindgen-cli to generate bindings for your programming language. For example, if you use Rust to develop your wasm component, you can either:
  • add wit-bindgen as a dependency to your project by cargo add wit-bindgen
  • use the wit_bindgen::generate macro to dynamically generate bindings.
wit_bindgen::generate!({
    world: "bindings",
    path: "<path/to/wit>",
    // ...
});

or:

  • install wit-bindgen-cli by cargo install wit-bindgen-cli
  • use shell command: ./wit-bindgen rust <path/to/wit> --out-dir <path/to/output> to statically generate these bindings.

After these steps, you'll able to use these APIs in your Rust project.

Examples:

We also provided a simple rust example in ./examples/wasm_module/Rust, to build it, make sure you have installed rustup wasm32-wasi target toolchain and cargo-component, then run

cargo component build -r

This will produce a wasm component in target/wasm32-wasi/release/psh-sdk-wit.wasm, to run it, you'll need to use PSH

./psh -p <pash/to/psh-sdk-wit.wasm>

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.