Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,14 @@ jobs:
os: macos-latest
- name: Windows
os: windows-latest
- name: Linux
os: ubuntu-latest

steps:
- name: Install JUCE's Linux Deps
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt install libasound2-dev libx11-dev libxinerama-dev libxext-dev libfreetype6-dev libwebkit2gtk-4.0-dev libglu1-mesa-dev xvfb ninja-build

- name: Checkout code
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3
Expand Down
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,21 @@ Start your app and perform the actions you want traced.

When you quit your app, a trace file will be dumped

**(Note: don't just terminate it via your IDE, the file will be only dumped on a graceful quit)**.
**(Note: don't just terminate it via your IDE, the file will *only* be written on a graceful quit)**.

The files will be dumped to the following locations:

* macOS: Your user's downloads folder
* Windows: Your desktop (sorry not sorry)
* Linux: Your user's documents folder

The exact file and location will be logged to `cout` (via JUCE's `DBG`) and will look like so:

```
Wrote perfetto trace to: /Users/sudara/Downloads/perfetto-DEBUG-2023-09-10_1937.pftrace
```

(I'll happily accept a PR to make this configurable.)

### Step 5: Drag the trace into Perfetto

Expand Down Expand Up @@ -324,7 +338,8 @@ Go wild!

## Assumptions / Caveats

* On Mac, the trace is dumped to your Downloads folder. On Windows, it's dumped to your Desktop (sorry not sorry).
* The location of the dump files are hardcoded at the moment! See [Step 4](#step-4-run-your-app) for locations.

* Traces are set to in memory, 80MB by default.

## Troubleshooting
Expand All @@ -342,7 +357,9 @@ target_compile_options("${PROJECT_NAME}" PUBLIC /Zc:__cplusplus)

### I don't see a trace file

Did you quit your app gracefully, such as with cmd-Q? If you instead just hit STOP on your IDE, you won't get a trace file.
Did you quit your app gracefully such as with cmd-Q?

If you instead just hit STOP on your IDE, you won't get a trace file.

### My traces appear empty

Expand Down
16 changes: 14 additions & 2 deletions melatonin_perfetto/melatonin_perfetto.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,23 @@ class MelatoninPerfetto

static juce::File getDumpFileDirectory()
{

juce::File directory;

#if JUCE_WINDOWS
return juce::File::getSpecialLocation (juce::File::SpecialLocationType::userDesktopDirectory);
directory = juce::File::getSpecialLocation (juce::File::SpecialLocationType::userDesktopDirectory);
#elif JUCE_LINUX
directory = juce::File::getSpecialLocation (juce::File::SpecialLocationType::userDocumentsDirectory);
#else
return juce::File::getSpecialLocation (juce::File::SpecialLocationType::userHomeDirectory).getChildFile ("Downloads");
directory = juce::File::getSpecialLocation (juce::File::SpecialLocationType::userHomeDirectory).getChildFile ("Downloads");
#endif

// File an issue if this ever asserts
// https://github.com/sudara/melatonin_perfetto/issues/new
jassert(directory.isDirectory());

return directory;

}

private:
Expand Down
9 changes: 8 additions & 1 deletion tests/AddSubdirectory/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,14 @@ FetchContent_MakeAvailable (JUCE)

add_subdirectory ("${MELATONIN_PERFETTO_ROOT}" "${CMAKE_CURRENT_BINARY_DIR}/melatonin_perfetto")

juce_add_console_app (test VERSION 1.0.0)
juce_add_console_app (test VERSION 1.0.0 NEEDS_CURL FALSE NEEDS_WEB_BROWSER FALSE)

# Reduce dependencies needed in CI
target_compile_definitions(test
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0
)

target_sources (test PRIVATE main.cpp)

Expand Down
11 changes: 9 additions & 2 deletions tests/FindPackage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,20 @@ FetchContent_Declare (JUCE
GIT_TAG origin/master
GIT_SHALLOW TRUE
GIT_PROGRESS TRUE
FIND_PACKAGE_ARGS 7.0.3)
FIND_PACKAGE_ARGS 7.0.6)

FetchContent_MakeAvailable (JUCE)

find_package (MelatoninPerfetto REQUIRED)

juce_add_console_app (test VERSION 1.0.0)
juce_add_console_app (test VERSION 1.0.0 NEEDS_CURL FALSE NEEDS_WEB_BROWSER FALSE)

# Reduce dependencies needed in CI
target_compile_definitions(test
JUCE_WEB_BROWSER=0
JUCE_USE_CURL=0
JUCE_VST3_CAN_REPLACE_VST2=0
)

target_sources (test PRIVATE main.cpp)

Expand Down