Skip to main content

Measure Code

Project description

Wrapper around MeasureSuite. In fact there are two wrappers. First a simple C command line interface, which allows you to pass C code and the corresponding asm block. The program then compiles automatically the needed shared library for MeasureSuite and runs it. This simple command line interface is then again wrapped in a python library which allows for an even easier usage.

Build:

Run:

git clone --recursive https://github.com/FloydZ/MeasureSuiteCommandLine
cd MeasureSuiteCommandLine
pip install -r requirements.txt
./build.sh

and that should do it. If you have nix install you can alternatively run:

git clone --recursive https://github.com/FloydZ/MeasureSuiteCommandLine
cd MeasureSuiteCommandLine
nix-shell

NOTE: currently the nix approach is broken, as the relative import from git via requirements is not possible.

C Interface

After you build the library a binary main is available in build. Use it like so:

./main "#include <stdint.h>
void add_two_numbers(uint64_t *o, const uint64_t *i0, const uint64_t *i1) { 
        *o = *i0 + *i1;
}" "mov rax, [rsi] 
add rax, [rdx] 
mov [rdi], rax
ret
"

After everything run successful you should see the output:

{
"stats":
  {
   "countA": 1,
   "countB": 1,
   "chunksA": 0,
   "chunksB": 0,
   "batchSize": 1,
   "numBatches": 1,
   "runtime": 0,
   "runOrder": "ba",
   "checkResult": true
   },
"times": [[-1,4792,1196],[798,-1,771]]
}

Python Wrapper:

c_code = "#include <stdint.h>\nvoid add_two_numbers(uint64_t *o, const uint64_t *i0, const uint64_t *i1) {\n  *o = *i0 + *i1;\n}\n"
asm_code = "TODO"
w = MS([c_code, asm_code])
d = w.run()
print(d)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

measuresuitecommandline-0.3.0.tar.gz (12.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

measuresuitecommandline-0.3.0-py3-none-any.whl (12.4 kB view details)

Uploaded Python 3

File details

Details for the file measuresuitecommandline-0.3.0.tar.gz.

File metadata

  • Download URL: measuresuitecommandline-0.3.0.tar.gz
  • Upload date:
  • Size: 12.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for measuresuitecommandline-0.3.0.tar.gz
Algorithm Hash digest
SHA256 1e22cabeacdc767baaf9ecde03db202f7576490ca7521af8ad331e70954d43b0
MD5 ef75d7bbf0f66844588993cfedb8d598
BLAKE2b-256 ba0b13da8c480305022fd56c6015a6e38d0e8575f891e735f72f654c74f156fd

See more details on using hashes here.

Provenance

The following attestation bundles were made for measuresuitecommandline-0.3.0.tar.gz:

Publisher: publish.yml on FloydZ/MeasureSuiteCommandLine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file measuresuitecommandline-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for measuresuitecommandline-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2e1890ebeff5bed667efa1c1d937e1171be3395e4346bc18def3ca838b9e8c8c
MD5 e65d285b0e256f165dc431b1b8dd7acc
BLAKE2b-256 8135b3334b3b4cd8d4399da02825858bd9e85c4ef6fd9b361e1a567a32e55afb

See more details on using hashes here.

Provenance

The following attestation bundles were made for measuresuitecommandline-0.3.0-py3-none-any.whl:

Publisher: publish.yml on FloydZ/MeasureSuiteCommandLine

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page