Skip to content

Conversation

@LiquidityC
Copy link
Member

@LiquidityC LiquidityC commented Oct 13, 2025

Summary by CodeRabbit

  • Chores
    • Added a new profiling build variant and standardized multi-platform CI matrix formatting to improve build coverage and consistency.
  • Refactor
    • Unified profiling-related build flags across modules to ensure consistent compilation behavior; no public APIs changed.
  • Notes
    • No user-facing functionality or runtime behavior changes expected.

@coderabbitai
Copy link

coderabbitai bot commented Oct 13, 2025

Walkthrough

Adds an Ubuntu GCC PROFILER CI job and normalizes workflow matrix formatting. Removes the numeric assignment from PROFILER in profiler.c and adds a #define PROFILER in rdtsc.c (after including <stdint.h>), enabling profiling-related compilation paths.

Changes

Cohort / File(s) Summary
CI workflow matrix updates
.github/workflows/cmake-multi-platform.yml
Added an Ubuntu (GCC, PROFILER) matrix entry with -DPROFILER=ON -GNinja; reformatted/normalized spacing for existing Ubuntu, Windows, and macOS entries without changing compilers or cmake args.
Profiler macro adjustments
lib/profiler/src/profiler.c, lib/profiler/src/rdtsc.c
In profiler.c changed #define PROFILER 1#define PROFILER. In rdtsc.c added #define PROFILER after including <stdint.h> to enable profiler-conditioned compilation.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

I nibble on flags and hop through CI,
A tiny rabbit with a watchful eye.
PROFILER set, builds hum through the night,
Ubuntu joins with a profiling light.
Hooray for tidy YAML and faster flights! 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title succinctly and accurately summarizes the two main changes: correcting the profiler build and adding a new CI workflow configuration. It is concise, specific, and directly reflects the modifications in the CI matrix and source files. Scanning this title gives clear insight into the pull request’s purpose.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_profiler_compile

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d2ec4ed and 685fa46.

📒 Files selected for processing (1)
  • .github/workflows/cmake-multi-platform.yml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/cmake-multi-platform.yml
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Windows (MSVC)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Ubuntu (GCC, PROFILER)
  • GitHub Check: Ubuntu (GCC)

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
.github/workflows/cmake-multi-platform.yml (1)

116-116: Consider including profiler build in tests.

The test step currently excludes mingw but doesn't explicitly consider the new PROF configuration. Verify whether profiler-enabled builds should run tests, or if there's a reason to exclude them.

If profiler builds should also run tests, consider updating the condition:

-      if: ${{ matrix.platform.os == 'ubuntu-latest' && matrix.platform.c_compiler != 'mingw-w64-gcc' }}
+      if: ${{ matrix.platform.os == 'ubuntu-latest' && matrix.platform.c_compiler != 'mingw-w64-gcc' }}

(The condition appears correct as-is, since it checks the compiler type rather than the platform name, so PROF builds should already be included. This comment is just to confirm the intent.)

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5f94006 and d2ec4ed.

📒 Files selected for processing (3)
  • .github/workflows/cmake-multi-platform.yml (1 hunks)
  • lib/profiler/src/profiler.c (1 hunks)
  • lib/profiler/src/rdtsc.c (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (8)
  • GitHub Check: Ubuntu (mingw)
  • GitHub Check: Ubuntu (GCC
  • GitHub Check: Analyze (c-cpp)
  • GitHub Check: Ubuntu (Clang)
  • GitHub Check: Mac (GCC)
  • GitHub Check: Mac (Clang)
  • GitHub Check: Ubuntu (GCC)
  • GitHub Check: Windows (MSVC)
🔇 Additional comments (1)
.github/workflows/cmake-multi-platform.yml (1)

34-34: Approve profiler-enabled CI job
The Ubuntu (GCC, PROF) entry with -DPROFILER=ON adds valuable coverage, and CMakeLists.txt already defines PROFILER as a cache option and applies -DPROFILER via add_definitions when enabled.

@@ -1,4 +1,4 @@
#define PROFILER 1
#define PROFILER
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Two concerns: hardcoded macro and potential breaking change.

  1. Hardcoded definition: Similar to rdtsc.c, the hardcoded #define PROFILER conflicts with the CI workflow's optional profiling builds. Consider defining this via CMake compiler flags instead.

  2. Macro semantics change: Removing the numeric value changes the macro from value-based (#define PROFILER 1) to presence-based (#define PROFILER). This is fine if all usage is #ifdef PROFILER, but could break code using #if PROFILER == 1 or similar value checks.

Run this script to verify how PROFILER is used throughout the codebase:


🏁 Script executed:

#!/bin/bash
# Check for potential breaking usage patterns

# Search for value-based checks that might break
rg -nP '#if\s+(PROFILER\s*(==|!=|>|<)|!PROFILER)' --type=c --type=cpp

# Show all PROFILER usage for context
rg -n -C2 'PROFILER' --type=c --type=cpp -g '!**/test/**'

Length of output: 2846


Remove hardcoded PROFILER definitions from source
Delete #define PROFILER from lib/profiler/src/{profiler.c, rdtsc.c, repetition_tester.c} and control profiling via build flags (e.g. add -DPROFILER in CMake).

🤖 Prompt for AI Agents
In lib/profiler/src/profiler.c around line 1 there is a hardcoded preprocessor
flag; remove the line "#define PROFILER" from this file (and similarly from
rdtsc.c and repetition_tester.c) and instead control profiling via build-time
defines (e.g., add -DPROFILER to the CMake target compile options). Ensure no
other code relies on that in-source define and update CMakeLists.txt to
conditionally add -DPROFILER for targets that require profiling.

@@ -1,5 +1,6 @@
#include <sys/time.h>
#include <stdint.h>
#define PROFILER
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion | 🟠 Major

🧩 Analysis chain

Hardcoded PROFILER macro conflicts with optional profiling builds.

The hardcoded #define PROFILER means profiling is always enabled in this file, which conflicts with the CI workflow's approach of having both profiler-enabled and non-profiler builds. If profiling should be optional, this macro should be defined via CMake compiler flags (e.g., -DPROFILER) rather than hardcoded in the source.

Please verify:

  1. Whether rdtsc.h has conditional compilation that requires PROFILER to be defined
  2. If profiling should be optional or always-on in this file

Run this script to check how rdtsc.h uses the PROFILER macro:

If profiling should be optional, consider removing this hardcoded define and ensuring CMake passes -DPROFILER to the compiler when the PROFILER option is enabled.


🏁 Script executed:

#!/bin/bash
# Check if rdtsc.h has conditional compilation based on PROFILER

# Search for PROFILER usage in rdtsc.h
rg -n -C3 'PROFILER' lib/profiler/include/ lib/profiler/src/

Length of output: 2939


Remove hardcoded PROFILER macros from source files
Define PROFILER via compiler flags (e.g., CMake -DPROFILER) instead of #define in rdtsc.c, repetition_tester.c, profiler.c so that profiling can be enabled or disabled per build.

🤖 Prompt for AI Agents
In lib/profiler/src/rdtsc.c around line 3 there is a hardcoded '#define
PROFILER'—remove that line and rely on defining PROFILER via compiler flags (for
example add -DPROFILER in your CMakeLists or build system) so profiling can be
enabled/disabled per build; ensure existing #ifdef PROFILER checks remain
unchanged and update the project build configuration to pass -DPROFILER when
profiling is desired (also remove the same hardcoded defines from
repetition_tester.c and profiler.c).

@LiquidityC LiquidityC merged commit 5867e17 into dev Oct 13, 2025
11 checks passed
@LiquidityC LiquidityC deleted the fix_profiler_compile branch October 13, 2025 07:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants