Skip to content
This repository was archived by the owner on Feb 16, 2022. It is now read-only.

fergloragain/apitrace-remote

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

apitrace-remote

Traces graphical applications remotely with apitrace, intended to be used in conjunction with the apitrace-remote-viewer

Building

go build -o main cmd/server/*go

Running

./main

User flow

  • Create an app
  • Trace the app
  • Get the dump
  • View the GL state

Create an app

Add the details for an application to be traced. Details include:

  • Name
  • Description
  • Git URL
  • User
  • Private key path
  • Branch
  • Build script
  • Executable
  • Timeout
  • apitrace location
  • glretrace location

Trace the app

Clones the git repo to a folder on disk, then runs the build script to produce the executable. Once built, the following command is ran against the executable:

apitrace trace myapp

With the trace file written on disk, apitrace is used to dump the per-frame GL calls with the following command:

apitrace dump myapp.trace

Get the dump

Retrieve the list of GL calls made for a specific frame of the app, beginning with frame 0. Clicking on a particular GL call will trigger a glretrace run to capture the GL state for that particular call:

glretrace -D=12345 myapp.trace

View the GL state

Following the call to glretrace, the colour, depth, and stencil buffers are viewable, as well as the GL state, including uniforms, shaders, buffers, etc

Endpoints

Apps

GET /apps

Retrieves a list of the applications stored in the database

Request
curl -X GET http://localhost:8080/apps
Response
[{"id":"hellmouthxyz","name":"hellmouthxyz","description":"jjkjklj","branch":"apitraceremote","traces":3}]

POST /apps/:name

Creates a new application in the database

Request
curl -X POST -d '{"description":"jjkjklj","url":"https://github.com/fergloragain/hellmouthxyz.git","executable":"main","apiTrace":"/Users/hellmouthxyz/development/apitrace/build/apitrace","retrace":"/Users/hellmouthxyz/development/apitrace/build/glretrace","timeout":2,"user":"","privateKey":"","buildScript":"build.sh","branch":"apitraceremote","dumpImages":true}' http://localhost:8080/apps/hellmouthxyztest
Response
{"id":"hellmouthxyztest-6","name":"hellmouthxyztest","description":"jjkjklj","url":"https://github.com/fergloragain/hellmouthxyz.git","executable":"main","apiTrace":"/Users/hellmouthxyz/development/apitrace/build/apitrace","retrace":"/Users/hellmouthxyz/development/apitrace/build/glretrace","timeout":2,"user":"","privateKey":"","buildScript":"build.sh","active":false,"branch":"apitraceremote","traces":[],"dumpImages":true}

GET /apps/:name

Gets the details for the :name app in the database

Request
curl -X GET http://localhost:8080/apps/hellmouthxyz-6
Response
{"id":"hellmouthxyz-6","name":"hellmouthxyz","description":"jjkjklj","url":"https://github.com/fergloragain/hellmouthxyz.git","executable":"main","apiTrace":"/Users/hellmouthxyz/development/apitrace/build/apitrace","retrace":"/Users/hellmouthxyz/development/apitrace/build/glretrace","timeout":2,"user":"","privateKey":"","buildScript":"build.sh","active":false,"branch":"apitraceremote","traces":["hellmouthxyz-trace-1","hellmouthxyz-trace-2","hellmouthxyz-trace-3"],"dumpImages":true}

PUT /apps/:name

Updates an existing application in the database

Request
curl -X PUT -d '{"description":"abc","url":"https://github.com/fergloragain/hellmouthxyz.git","executable":"main","apiTrace":"/Users/hellmouthxyz/development/apitrace/build/apitrace","retrace":"/Users/hellmouthxyz/development/apitrace/build/glretrace","timeout":2,"user":"","privateKey":"","buildScript":"build.sh","branch":"apitraceremote","dumpImages":true}' http://localhost:8080/apps/hellmouthxyztest-6
Response
{"id":"hellmouthxyztest-6","name":"hellmouthxyztest","description":"abc","url":"https://github.com/fergloragain/hellmouthxyz.git","executable":"main","apiTrace":"/Users/hellmouthxyz/development/apitrace/build/apitrace","retrace":"/Users/hellmouthxyz/development/apitrace/build/glretrace","timeout":2,"user":"","privateKey":"","buildScript":"build.sh","active":false,"branch":"apitraceremote","traces":[],"dumpImages":true}

Traces

GET /traces

Retrieves a list of the traces stored in the database

Request
curl -X GET http://localhost:8080/traces
Response
["hellmouthxyz-1-trace","hellmouthxyz-1-trace-1"]

POST /traces/:name

Creates a new trace in the database for the :name app

Request
curl -X POST http://localhost:8080/traces/hellmouthxyztest
Response
{"id":"hellmouthxyztest-trace","appID":"hellmouthxyztest","name":"hellmouthxyztest-trace","status":"Pending","buildStdout":"","buildStderr":"","traceStdout":"","traceStderr":"","cloneStdout":"","cloneStderr":"","dumpStderr":"","targetDirectory":"","numberOfFrames":0,"retraces":[],"traceFile":""}

GET /traces/:name

Gets the details for the :name trace in the database

Request
curl -X GET http://localhost:8080/traces/hellmouthxyz-23-trace
Response
{"id":"hellmouthxyz-23-trace","appID":"hellmouthxyz-23","name":"hellmouthxyz-23-trace","status":"Pending","buildStdout":"","buildStderr":"","traceStdout":"","traceStderr":"","cloneStdout":"","cloneStderr":"","dumpStderr":"","targetDirectory":"","numberOfFrames":0,"retraces":[],"traceFile":""}

Todo

  • Make the project go get friendly
  • Add config file for default values for new apps
  • Add Docker files and a docker-compose.yaml
  • Fix up deletion so that deletion of a project triggers deletion of:
    • All DB data
      • Retrace data
      • Dump data
      • App data
    • All on disk data
      • Project folder
      • Trace directories
  • Add pagination for viewing the dump; i.e. if a single frame makes 10,000 calls, then return the first 100 calls, and retrieve the next set when the page is scrolled to the bottom
  • Trigger the glretrace operations asynchronously, and have the client application poll the status repeatedly
  • Add the a profiling call for glretrace
  • Add logic so that instead of re-cloning the source code every time, a git pull is performed and a rebuild triggered, unless explicitly stated otherwise
  • Move the executable into a separate trace folder
  • Add disk statistics to the data set returned, so we know how much disk space a particular application/trace is using
  • Rework and streamline the application triggering process, as well as stdout and stderr capture

About

This was one of my earliest go projects, from around 2015. The idea was to make apitrace traces viewable over the internet. No longer maintained and probably broken!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors