Skip to content

CXXCBC-775: Import system_metrics library from C++ FIT performer#904

Merged
avsej merged 1 commit intocouchbase:mainfrom
avsej:system-metrics
Mar 17, 2026
Merged

CXXCBC-775: Import system_metrics library from C++ FIT performer#904
avsej merged 1 commit intocouchbase:mainfrom
avsej:system-metrics

Conversation

@avsej
Copy link
Copy Markdown
Member

@avsej avsej commented Mar 12, 2026

As part of the effort to migrate the C++ FIT performer from the transactions-fit-performer repository into the C++ SDK, this commit imports the system_metrics library.

This is the first step in making the C++ SDK self-contained for FIT testing, allowing the performer to be built and released as part of the SDK.

The commit also adds a new 'cbc sysinfo' command to the cbc tool as an integration test for the library.

Examples:

cbc sysinfo
cbc sysinfo --pid 3580
cbc sysinfo --pid 3580 --json
cbc sysinfo --pid 3580 --json --poll 2

@avsej avsej requested review from a team, DemetrisChr, Matt-Woz and thejcfactor March 12, 2026 23:57
@avsej avsej force-pushed the system-metrics branch 3 times, most recently from 45544f1 to 40f0425 Compare March 13, 2026 23:32
@avsej avsej requested a review from Copilot March 13, 2026 23:36
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK to support migrating the C++ FIT performer, and adds a cbc sysinfo subcommand to exercise the new metrics collection as an integration-style check.

Changes:

  • Added the tools/system_metrics library with OS-specific implementations (Linux/macOS/Windows) and shared utilities.
  • Added a new cbc sysinfo command to display per-process and system metrics (optionally as JSON).
  • Wired system_metrics into the tools build via CMake and registered the new cbc subcommand.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 18 comments.

Show a summary per file
File Description
tools/system_metrics/src/utils.hxx Declares shared utility helpers/constants for the metrics backends.
tools/system_metrics/src/utils.cxx Implements file I/O + parsing helpers used by Linux/Windows backends.
tools/system_metrics/src/system_metrics.cxx Factory to select OS-specific SystemMetrics implementation.
tools/system_metrics/src/os/linux_system_metrics.hxx Declares Linux metrics backend.
tools/system_metrics/src/os/linux_system_metrics.cxx Implements Linux /proc-based metrics collection.
tools/system_metrics/src/os/macos_system_metrics.hxx Declares macOS metrics backend.
tools/system_metrics/src/os/macos_system_metrics.cxx Implements macOS metrics collection via Mach/libproc/sysctl.
tools/system_metrics/src/os/windows_system_metrics.hxx Declares Windows metrics backend.
tools/system_metrics/src/os/windows_system_metrics.cxx Implements Windows metrics collection via Win32 APIs.
tools/system_metrics/include/system_metrics.hxx Public API types and abstract interface for system metrics.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory interface for creating a metrics provider.
tools/system_metrics/README.md Documents the imported library and its intended scope.
tools/system_metrics/CMakeLists.txt Adds the object library target for system_metrics.
tools/sysinfo.hxx Declares the cbc sysinfo command entrypoints.
tools/sysinfo.cxx Implements cbc sysinfo CLI behavior + JSON/plain output formatting.
tools/cbc.cxx Registers/dispatches the new sysinfo subcommand.
tools/CMakeLists.txt Adds sysinfo.cxx to cbc and links system_metrics_cxx.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Comment thread tools/system_metrics/src/utils.cxx Outdated
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Comment thread tools/sysinfo.cxx Outdated
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx
Comment thread tools/system_metrics/src/utils.cxx Outdated
Comment thread tools/system_metrics/src/utils.cxx Outdated
Comment thread tools/system_metrics/README.md Outdated
Comment thread tools/sysinfo.cxx
Comment thread tools/sysinfo.cxx Outdated
@avsej avsej force-pushed the system-metrics branch 7 times, most recently from 750b500 to fc87c59 Compare March 14, 2026 01:32
@avsej avsej requested a review from Copilot March 14, 2026 01:34
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK to support FIT performer migration, and adds a new cbc sysinfo subcommand as an integration surface for the metrics collection.

Changes:

  • Added a new tools/system_metrics object library with Linux/macOS/Windows implementations of per-process metrics.
  • Added cbc sysinfo subcommand to display metrics (optionally JSON / polled).
  • Added core::meta::is_debug() and updated cbc dispatch to avoid catching exceptions in debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory to instantiate the correct OS metrics implementation.
tools/system_metrics/src/os/linux_system_metrics.hxx Declares Linux metrics backend.
tools/system_metrics/src/os/linux_system_metrics.cxx Implements Linux metrics backend using /proc.
tools/system_metrics/src/os/macos_system_metrics.hxx Declares macOS metrics backend.
tools/system_metrics/src/os/macos_system_metrics.cxx Implements macOS metrics backend using Mach / libproc.
tools/system_metrics/src/os/windows_system_metrics.hxx Declares Windows metrics backend.
tools/system_metrics/src/os/windows_system_metrics.cxx Implements Windows metrics backend using Win32 APIs.
tools/system_metrics/include/system_metrics.hxx Public API for metrics types and interface.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for backend selection.
tools/system_metrics/README.md Documents the imported library’s provenance and intended scope.
tools/system_metrics/CMakeLists.txt Adds CMake target for the system metrics object library.
tools/sysinfo.hxx Declares the new cbc sysinfo command entry points.
tools/sysinfo.cxx Implements cbc sysinfo output and JSON serialization.
tools/cbc.cxx Registers and dispatches the new sysinfo subcommand; adjusts debug exception behavior.
tools/CMakeLists.txt Builds sysinfo.cxx and links system_metrics_cxx into cbc.
core/meta/version.hxx Declares is_debug() helper.
core/meta/version.cxx Implements is_debug() based on CMAKE_BUILD_TYPE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Comment thread tools/system_metrics/src/system_metrics.cxx Outdated
Comment thread core/meta/version.cxx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK repo as part of making the C++ FIT performer buildable/releasable from the SDK, and wires it into the cbc tool via a new sysinfo subcommand.

Changes:

  • Added cross-platform system_metrics library (Linux/macOS/Windows backends) and CMake target.
  • Added cbc sysinfo command to exercise/report per-process/system metrics (text + JSON).
  • Updated cbc dispatch to avoid catching exceptions in Debug builds via a new core::meta::is_debug() helper.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory for selecting the OS-specific SystemMetrics implementation.
tools/system_metrics/src/os/windows_system_metrics.hxx Declares Windows metrics backend.
tools/system_metrics/src/os/windows_system_metrics.cxx Implements Windows process/system metrics collection.
tools/system_metrics/src/os/macos_system_metrics.hxx Declares macOS metrics backend.
tools/system_metrics/src/os/macos_system_metrics.cxx Implements macOS process/system metrics collection.
tools/system_metrics/src/os/linux_system_metrics.hxx Declares Linux metrics backend.
tools/system_metrics/src/os/linux_system_metrics.cxx Implements Linux /proc-based metrics collection.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating metrics implementations.
tools/system_metrics/include/system_metrics.hxx Public metrics interface + shared types.
tools/system_metrics/README.md Notes provenance and future TODOs for the imported library.
tools/system_metrics/CMakeLists.txt Builds system_metrics_cxx object library and sets include/link requirements.
tools/sysinfo.hxx Declares new cbc sysinfo command hooks.
tools/sysinfo.cxx Implements cbc sysinfo output formatting + polling + JSON serialization.
tools/cbc.cxx Registers and dispatches the new sysinfo subcommand; adjusts exception handling in Debug.
tools/CMakeLists.txt Adds sysinfo.cxx, adds system_metrics subdir, links system_metrics_cxx into cbc.
core/meta/version.hxx Declares new is_debug() helper.
core/meta/version.cxx Implements is_debug() using generated CMAKE_BUILD_TYPE.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/sysinfo.cxx Outdated
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK tooling and adds a new cbc sysinfo command to exercise per-process/system boot metrics across platforms, supporting the effort to make the C++ FIT performer buildable from within this repository.

Changes:

  • Added tools/system_metrics library (Linux/macOS/Windows backends + reporter factory).
  • Added cbc sysinfo subcommand to display metrics in text or JSON (optionally polling).
  • Refactored cbc command dispatch to avoid catching exceptions in debug builds via core::meta::is_debug().

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory for selecting OS-specific metrics backend.
tools/system_metrics/src/os/linux_system_metrics.{hxx,cxx} Linux /proc implementation for process/system metrics.
tools/system_metrics/src/os/macos_system_metrics.{hxx,cxx} macOS implementation using sysctl, libproc, and Mach APIs.
tools/system_metrics/src/os/windows_system_metrics.{hxx,cxx} Windows implementation using Toolhelp + PSAPI process/thread queries.
tools/system_metrics/include/system_metrics.{hxx} Public API types and SystemMetrics interface.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating a backend instance.
tools/system_metrics/CMakeLists.txt Build definition for the imported object library.
tools/system_metrics/README.md Library overview and TODO.
tools/sysinfo.{hxx,cxx} New cbc sysinfo command and JSON/text formatting.
tools/cbc.cxx Registers and dispatches the new sysinfo subcommand; debug-mode exception behavior.
tools/CMakeLists.txt Builds sysinfo.cxx, adds system_metrics subdir, links the new target.
core/meta/version.{hxx,cxx} Adds is_debug() helper used by tooling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/CMakeLists.txt Outdated
Comment thread tools/system_metrics/CMakeLists.txt Outdated
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Comment thread core/meta/version.cxx Outdated
Comment thread tools/system_metrics/src/os/macos_system_metrics.cxx Outdated
Comment thread tools/system_metrics/src/os/macos_system_metrics.cxx Outdated
@avsej avsej requested a review from Copilot March 14, 2026 06:50
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR imports the system_metrics library into the SDK to support FIT performer migration, and adds a cbc sysinfo subcommand to exercise/validate the imported metrics collection as part of tooling.

Changes:

  • Added tools/system_metrics library with per-OS implementations for process CPU/memory/thread metrics.
  • Added cbc sysinfo command (with optional JSON output and polling) and wired it into the cbc tool build and dispatch.
  • Added couchbase::core::meta::is_debug() and used it to avoid top-level exception catching in debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory for selecting OS-specific system_metrics implementation.
tools/system_metrics/src/os/linux_system_metrics.hxx Linux backend interface declaration.
tools/system_metrics/src/os/linux_system_metrics.cxx Linux /proc-based process/thread metrics implementation.
tools/system_metrics/src/os/macos_system_metrics.hxx macOS backend interface declaration.
tools/system_metrics/src/os/macos_system_metrics.cxx macOS process/thread metrics implementation via Mach/libproc/sysctl.
tools/system_metrics/src/os/windows_system_metrics.hxx Windows backend interface declaration.
tools/system_metrics/src/os/windows_system_metrics.cxx Windows process/thread metrics implementation via Win32 APIs.
tools/system_metrics/include/system_metrics.hxx Public system_metrics API/types and callback contract.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating system_metrics instances.
tools/system_metrics/README.md Library overview/background documentation.
tools/system_metrics/CMakeLists.txt Build definition for the imported system_metrics object library.
tools/sysinfo.hxx Declaration for the new cbc sysinfo subcommand.
tools/sysinfo.cxx Implementation of cbc sysinfo output formatting, JSON, and polling.
tools/cbc.cxx Registers and dispatches the sysinfo subcommand; adjusts exception handling in debug.
tools/CMakeLists.txt Adds sysinfo.cxx to cbc sources and links system_metrics_cxx.
core/meta/version.hxx Declares couchbase::core::meta::is_debug().
core/meta/version.cxx Implements couchbase::core::meta::is_debug().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/sysinfo.cxx
Comment thread tools/system_metrics/src/os/windows_system_metrics.cxx
Comment thread tools/system_metrics/src/os/windows_system_metrics.cxx
Comment thread tools/system_metrics/src/os/macos_system_metrics.cxx Outdated
@avsej avsej force-pushed the system-metrics branch 2 times, most recently from e33b211 to 5075425 Compare March 16, 2026 20:30
@avsej avsej requested a review from Copilot March 16, 2026 20:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the tools/system_metrics library into the SDK repo to support the FIT performer migration, and adds a cbc sysinfo subcommand to exercise the new library as an integration-style check.

Changes:

  • Add cross-platform system_metrics implementation (Linux/macOS/Windows) plus factory (system_metrics_reporter).
  • Add cbc sysinfo command with text/JSON output and optional polling.
  • Add couchbase::core::meta::is_debug() and adjust cbc exception handling in debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Implements OS selection factory for metrics backend.
tools/system_metrics/src/os/windows_system_metrics.hxx Declares Windows backend.
tools/system_metrics/src/os/windows_system_metrics.cxx Implements Windows process/thread metrics collection.
tools/system_metrics/src/os/macos_system_metrics.hxx Declares macOS backend.
tools/system_metrics/src/os/macos_system_metrics.cxx Implements macOS process/thread metrics collection.
tools/system_metrics/src/os/linux_system_metrics.hxx Declares Linux backend.
tools/system_metrics/src/os/linux_system_metrics.cxx Implements Linux /proc-based metrics collection.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating metrics backends.
tools/system_metrics/include/system_metrics.hxx Public metrics interface/types.
tools/system_metrics/README.md Documents library purpose and TODOs.
tools/system_metrics/CMakeLists.txt Adds system_metrics_cxx object library and include/link settings.
tools/sysinfo.hxx Declares new cbc sysinfo command entrypoints.
tools/sysinfo.cxx Implements cbc sysinfo command output and polling/JSON formatting.
tools/cbc.cxx Registers sysinfo subcommand and refactors dispatch/exception behavior.
tools/CMakeLists.txt Builds sysinfo.cxx and links system_metrics_cxx into cbc.
core/meta/version.hxx Declares couchbase::core::meta::is_debug().
core/meta/version.cxx Implements is_debug() using COUCHBASE_CXX_CLIENT_DEBUG_BUILD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/sysinfo.cxx
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK to support migrating the C++ FIT performer in-repo, and adds a cbc sysinfo subcommand as a basic integration test/diagnostic for the new library.

Changes:

  • Add tools/system_metrics library with per-OS implementations (Linux/macOS/Windows) and a reporter factory.
  • Add cbc sysinfo command that prints per-process CPU/memory/thread metrics (text or JSON), optionally polling.
  • Add couchbase::core::meta::is_debug() and use it in cbc to avoid catch/rethrow in debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory implementation selecting OS backend.
tools/system_metrics/src/os/linux_system_metrics.hxx Linux backend interface.
tools/system_metrics/src/os/linux_system_metrics.cxx Linux /proc-based metrics implementation.
tools/system_metrics/src/os/macos_system_metrics.hxx macOS backend interface.
tools/system_metrics/src/os/macos_system_metrics.cxx macOS metrics implementation using sysctl/libproc/mach APIs.
tools/system_metrics/src/os/windows_system_metrics.hxx Windows backend interface.
tools/system_metrics/src/os/windows_system_metrics.cxx Windows metrics implementation using Win32 APIs.
tools/system_metrics/include/system_metrics.hxx Public API for metrics backends/types.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating a metrics backend.
tools/system_metrics/README.md High-level description and TODOs for the imported library.
tools/system_metrics/CMakeLists.txt Build rules for the new system_metrics object library.
tools/sysinfo.hxx Declares the new cbc sysinfo CLI subcommand.
tools/sysinfo.cxx Implements cbc sysinfo output/JSON/polling using system_metrics.
tools/cbc.cxx Registers and dispatches the sysinfo subcommand; debug-mode exception behavior.
tools/CMakeLists.txt Adds sysinfo source and links cbc with the system_metrics library.
core/meta/version.hxx Declares couchbase::core::meta::is_debug().
core/meta/version.cxx Implements couchbase::core::meta::is_debug().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/sysinfo.cxx
Comment thread tools/sysinfo.cxx Outdated
Comment thread tools/sysinfo.cxx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK repository to support migrating the C++ FIT performer, and adds a cbc sysinfo subcommand as an integration-style consumer of the library.

Changes:

  • Added new tools/system_metrics object library with per-OS implementations (Linux/macOS/Windows) and a reporter factory.
  • Added cbc sysinfo command to display per-process CPU/memory/thread metrics (optionally JSON + polling).
  • Added couchbase::core::meta::is_debug() and adjusted cbc exception handling to avoid catch/rethrow in debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory for selecting OS-specific system_metrics implementation.
tools/system_metrics/src/os/linux_system_metrics.{hxx,cxx} Linux /proc implementation for process CPU/memory/thread metrics.
tools/system_metrics/src/os/macos_system_metrics.{hxx,cxx} macOS implementation using sysctl, libproc, and Mach APIs.
tools/system_metrics/src/os/windows_system_metrics.{hxx,cxx} Windows implementation using Win32 APIs for process CPU/memory/thread metrics.
tools/system_metrics/include/system_metrics.hxx Public interface/types for the system_metrics library.
tools/system_metrics/include/system_metrics_reporter.hxx Public reporter/factory API for consumers.
tools/system_metrics/README.md Brief overview/TODO for the imported library.
tools/system_metrics/CMakeLists.txt Builds system_metrics_cxx object library and exports include dirs/link deps.
tools/sysinfo.{hxx,cxx} New cbc sysinfo command implementation and CLI wiring.
tools/cbc.cxx Registers sysinfo subcommand; adds debug-aware exception handling.
tools/CMakeLists.txt Adds sysinfo.cxx, adds system_metrics subdir, links cbc to system_metrics_cxx.
core/meta/version.hxx Declares couchbase::core::meta::is_debug().
core/meta/version.cxx Implements couchbase::core::meta::is_debug().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/include/system_metrics.hxx
Comment thread tools/system_metrics/src/os/macos_system_metrics.cxx
Comment thread tools/system_metrics/src/os/linux_system_metrics.cxx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK to support migrating the C++ FIT performer in-repo, and adds a cbc sysinfo subcommand to exercise the library as an integration point.

Changes:

  • Added tools/system_metrics object library with Linux/macOS/Windows process/system metrics backends and a factory (system_metrics_reporter).
  • Added cbc sysinfo command (human-readable + JSON output, optional polling) and wired it into cbc.
  • Exposed couchbase::core::meta::is_debug() and used it to preserve exception stack traces in debug builds for cbc.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory for selecting OS backend implementation.
tools/system_metrics/src/os/linux_system_metrics.hxx Linux backend interface declaration.
tools/system_metrics/src/os/linux_system_metrics.cxx Linux backend implementation using /proc.
tools/system_metrics/src/os/macos_system_metrics.hxx macOS backend interface declaration.
tools/system_metrics/src/os/macos_system_metrics.cxx macOS backend implementation using Mach/libproc/sysctl.
tools/system_metrics/src/os/windows_system_metrics.hxx Windows backend interface declaration.
tools/system_metrics/src/os/windows_system_metrics.cxx Windows backend implementation using Win32/PSAPI/Toolhelp.
tools/system_metrics/include/system_metrics.hxx Public API types and abstract interface for metrics.
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating a metrics backend.
tools/system_metrics/README.md High-level library notes and TODOs.
tools/system_metrics/CMakeLists.txt Adds system_metrics_cxx object library target and include/link settings.
tools/sysinfo.hxx Declares cbc sysinfo command entry points.
tools/sysinfo.cxx Implements cbc sysinfo command and JSON/human output.
tools/cbc.cxx Registers sysinfo command and adjusts exception handling based on debug build.
tools/CMakeLists.txt Builds sysinfo.cxx and links cbc with system_metrics_cxx.
core/meta/version.hxx Declares couchbase::core::meta::is_debug().
core/meta/version.cxx Defines is_debug() using COUCHBASE_CXX_CLIENT_DEBUG_BUILD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/src/system_metrics.cxx
Comment thread tools/sysinfo.cxx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK to support migrating the C++ FIT performer in-repo, and adds a cbc sysinfo subcommand as an integration-style exerciser for the new metrics provider.

Changes:

  • Added a new tools/system_metrics library with per-OS implementations (Linux/macOS/Windows) plus a factory (system_metrics_reporter).
  • Introduced a new cbc sysinfo command to print process/system metrics (optionally JSON, optionally polled).
  • Exposed couchbase::core::meta::is_debug() and updated cbc to avoid catching exceptions in debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Implements the system_metrics_reporter factory selecting an OS backend.
tools/system_metrics/src/os/linux_system_metrics.hxx Declares Linux /proc-based backend.
tools/system_metrics/src/os/linux_system_metrics.cxx Implements Linux process metrics via /proc.
tools/system_metrics/src/os/macos_system_metrics.hxx Declares macOS backend.
tools/system_metrics/src/os/macos_system_metrics.cxx Implements macOS process metrics via sysctl, libproc, and Mach APIs.
tools/system_metrics/src/os/windows_system_metrics.hxx Declares Windows backend.
tools/system_metrics/src/os/windows_system_metrics.cxx Implements Windows process metrics via Win32 APIs (GetProcessTimes, GetProcessMemoryInfo, Toolhelp snapshot).
tools/system_metrics/include/system_metrics_reporter.hxx Adds public factory API for obtaining a system_metrics implementation.
tools/system_metrics/include/system_metrics.hxx Adds the cross-platform metrics interface and data structures.
tools/system_metrics/README.md Documents provenance and goals of the imported metrics code.
tools/system_metrics/CMakeLists.txt Builds system_metrics_cxx and links platform deps (psapi on Windows).
tools/sysinfo.hxx Declares the new cbc subcommand interface for sysinfo.
tools/sysinfo.cxx Implements cbc sysinfo output formatting, JSON serialization, and polling.
tools/cbc.cxx Registers/dispatches the sysinfo subcommand; changes exception handling in debug vs release.
tools/CMakeLists.txt Adds sysinfo.cxx, builds system_metrics subdir, and links it into cbc.
core/meta/version.hxx Declares couchbase::core::meta::is_debug().
core/meta/version.cxx Implements is_debug() based on COUCHBASE_CXX_CLIENT_DEBUG_BUILD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/src/os/macos_system_metrics.cxx
Comment thread tools/system_metrics/src/os/windows_system_metrics.cxx Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK toolchain to support the in-repo C++ FIT performer migration, and adds a cbc sysinfo command as an integration exercise of the new library.

Changes:

  • Added tools/system_metrics library with per-OS implementations (Linux/macOS/Windows) and a system_metrics_reporter factory.
  • Added cbc sysinfo subcommand to print process/system metrics (optionally JSON and polling).
  • Added couchbase::core::meta::is_debug() and updated cbc to avoid exception catching in debug builds for better stack traces.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory that selects the OS backend implementation.
tools/system_metrics/src/os/* OS-specific implementations for CPU/memory/thread metrics.
tools/system_metrics/include/* Public API for the system metrics library.
tools/system_metrics/CMakeLists.txt Builds the system_metrics object library and sets include dirs/link deps.
tools/system_metrics/README.md Documents provenance and intended scope of the imported library.
tools/sysinfo.cxx / tools/sysinfo.hxx Implements the new cbc sysinfo CLI subcommand.
tools/cbc.cxx Registers and dispatches the new sysinfo subcommand; adjusts debug exception handling.
tools/CMakeLists.txt Adds sysinfo sources and links cbc with system_metrics.
core/meta/version.hxx / core/meta/version.cxx Exposes is_debug() for runtime debug-build detection.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/CMakeLists.txt Outdated
Comment thread tools/system_metrics/src/system_metrics.cxx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports a cross-platform system_metrics library into the SDK to support making the C++ FIT performer self-contained, and adds a cbc sysinfo subcommand to exercise the new functionality.

Changes:

  • Added tools/system_metrics library with Linux/macOS/Windows implementations and a factory (system_metrics_reporter).
  • Added cbc sysinfo command for human-readable and JSON sysinfo output (optionally polling).
  • Added couchbase::core::meta::is_debug() and updated cbc to avoid exception-catching in Debug builds.

Reviewed changes

Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tools/system_metrics/src/system_metrics.cxx Factory that selects an OS-specific system_metrics implementation.
tools/system_metrics/src/os/windows_system_metrics.hxx Windows backend interface.
tools/system_metrics/src/os/windows_system_metrics.cxx Windows backend implementation (proc CPU/memory/thread iteration).
tools/system_metrics/src/os/macos_system_metrics.hxx macOS backend interface.
tools/system_metrics/src/os/macos_system_metrics.cxx macOS backend implementation (sysctl/mach/proc APIs).
tools/system_metrics/src/os/linux_system_metrics.hxx Linux backend interface.
tools/system_metrics/src/os/linux_system_metrics.cxx Linux backend implementation (/proc parsing + thread iteration).
tools/system_metrics/include/system_metrics_reporter.hxx Public factory header for creating system_metrics.
tools/system_metrics/include/system_metrics.hxx Public API types and abstract interface.
tools/system_metrics/README.md Brief background and TODOs for the imported library.
tools/system_metrics/CMakeLists.txt Builds system_metrics_cxx object library and exports includes/link reqs.
tools/sysinfo.hxx Declares cbc sysinfo command wiring.
tools/sysinfo.cxx Implements cbc sysinfo command (text/JSON output, polling, signals).
tools/cbc.cxx Registers sysinfo subcommand and adds Debug-mode dispatch behavior.
tools/CMakeLists.txt Adds sysinfo.cxx, builds system_metrics, and links it into cbc.
core/meta/version.hxx Declares new is_debug() helper.
core/meta/version.cxx Defines is_debug() helper using build-time macro.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/src/system_metrics.cxx
Comment thread tools/sysinfo.hxx
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK’s tools/ area as part of making the C++ FIT performer self-contained, and adds a new cbc sysinfo subcommand as an integration-style exercise of the library.

Changes:

  • Added a new tools/system_metrics object library with Linux/macOS/Windows backends and a reporter factory.
  • Added cbc sysinfo command to print per-process/system metrics in text or JSON (optionally polled).
  • Added couchbase::core::meta::is_debug() and updated cbc to avoid top-level exception catching in Debug builds; also added #pragma once/<memory> include hygiene across tool headers.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/system_metrics/CMakeLists.txt Builds the imported system_metrics_cxx object library and sets include/link requirements.
tools/system_metrics/include/system_metrics.hxx Defines the system_metrics interface and shared types.
tools/system_metrics/include/system_metrics_reporter.hxx Adds a factory API to select an OS backend.
tools/system_metrics/src/system_metrics.cxx Implements backend selection (OperatingSystem → concrete implementation).
tools/system_metrics/src/os/linux_system_metrics.{hxx,cxx} Linux /proc-based implementation.
tools/system_metrics/src/os/macos_system_metrics.{hxx,cxx} macOS implementation via Mach/libproc/sysctl.
tools/system_metrics/src/os/windows_system_metrics.{hxx,cxx} Windows implementation via Win32/PSAPI/ToolHelp APIs.
tools/system_metrics/README.md Documents provenance and scope of the imported code.
tools/sysinfo.hxx / tools/sysinfo.cxx Implements the new cbc sysinfo subcommand (text/JSON output, polling, PID selection).
tools/cbc.cxx Registers and dispatches sysinfo; gates top-level exception catching with is_debug().
tools/CMakeLists.txt Builds sysinfo.cxx, adds system_metrics subdir, links system_metrics_cxx into cbc.
core/meta/version.hxx / core/meta/version.cxx Introduces couchbase::core::meta::is_debug() wrapper for build config.
tools/{analytics,beam,config,get,keygen,pillowfight,query,remove,upsert,version}.hxx Adds #pragma once and <memory> where std::shared_ptr APIs are declared.
tools/pillowfight.cxx Adds <memory> include (header usage alignment).
tools/utils.hxx Minor include ordering adjustment (<cstdint>).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK (as part of FIT performer migration) and adds a cbc sysinfo subcommand to exercise it as an integration-style tool command.

Changes:

  • Add tools/system_metrics cross-platform (Linux/macOS/Windows) process/system metrics implementation and build integration.
  • Add cbc sysinfo command to display per-process/system metrics (optionally JSON, optionally polling).
  • Add couchbase::core::meta::is_debug() and use it to avoid exception-catching in cbc debug builds.

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/version.hxx Add #pragma once and include <memory> for std::shared_ptr declaration.
tools/utils.hxx Reorder includes (moves <cstdint>).
tools/upsert.hxx Add #pragma once and include <memory>.
tools/system_metrics/src/system_metrics.cxx Factory for OS-specific system_metrics backends.
tools/system_metrics/src/os/windows_system_metrics.hxx Windows backend class declaration.
tools/system_metrics/src/os/windows_system_metrics.cxx Windows backend implementation (process cpu/memory/thread enumeration).
tools/system_metrics/src/os/macos_system_metrics.hxx macOS backend class declaration.
tools/system_metrics/src/os/macos_system_metrics.cxx macOS backend implementation (Mach/libproc/sysctl based).
tools/system_metrics/src/os/linux_system_metrics.hxx Linux backend class declaration.
tools/system_metrics/src/os/linux_system_metrics.cxx Linux backend implementation (/proc parsing).
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating a metrics backend.
tools/system_metrics/include/system_metrics.hxx Public interface/types for system/process/thread metrics.
tools/system_metrics/README.md Documentation for imported system_metrics library.
tools/system_metrics/CMakeLists.txt Build definition for system_metrics_cxx object library and Windows link deps.
tools/sysinfo.hxx Declares cbc sysinfo command hooks.
tools/sysinfo.cxx Implements cbc sysinfo command, formatting, JSON output, and polling.
tools/remove.hxx Add #pragma once and include <memory>.
tools/query.hxx Add #pragma once and include <memory>.
tools/pillowfight.hxx Add #pragma once and include <memory>.
tools/pillowfight.cxx Add missing <memory> include.
tools/keygen.hxx Add #pragma once and include <memory>.
tools/get.hxx Add #pragma once and include <memory>.
tools/config.hxx Add #pragma once and include <memory>.
tools/cbc.cxx Register/dispatch sysinfo; adjust exception handling based on debug build.
tools/beam.hxx Add #pragma once and include <memory>.
tools/analytics.hxx Add #pragma once and include <memory>.
tools/CMakeLists.txt Build sysinfo.cxx; add and link system_metrics subdirectory/target.
core/meta/version.hxx Declare new couchbase::core::meta::is_debug().
core/meta/version.cxx Define is_debug() using COUCHBASE_CXX_CLIENT_DEBUG_BUILD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment thread tools/system_metrics/README.md Outdated
As part of the effort to migrate the C++ FIT performer from the
transactions-fit-performer repository into the C++ SDK, this commit
imports the system_metrics library.

This is the first step in making the C++ SDK self-contained for FIT
testing, allowing the performer to be built and released as part of
the SDK.

The commit also adds a new 'cbc sysinfo' command to the cbc tool as
an integration test for the library.

Examples:

  cbc sysinfo
  cbc sysinfo --pid 3580
  cbc sysinfo --pid 3580 --json
  cbc sysinfo --pid 3580 --json --poll 2
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Imports the system_metrics library into the SDK tools tree to support migrating the C++ FIT performer into this repository, and wires it into cbc via a new sysinfo subcommand to act as an integration test/utility.

Changes:

  • Added a new tools/system_metrics object library with Linux/macOS/Windows implementations and a small factory API.
  • Added cbc sysinfo command that prints process/system metrics (optionally JSON) and supports polling.
  • Updated tool command headers and cbc dispatching (including debug-mode exception behavior via core::meta::is_debug()).

Reviewed changes

Copilot reviewed 29 out of 29 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tools/version.hxx Add #pragma once and <memory> for command factory types.
tools/utils.hxx Include ordering adjustment for <cstdint>.
tools/upsert.hxx Add #pragma once and <memory> for command factory types.
tools/system_metrics/src/system_metrics.cxx Factory implementation selecting per-OS backend.
tools/system_metrics/src/os/windows_system_metrics.hxx Windows backend class declaration.
tools/system_metrics/src/os/windows_system_metrics.cxx Windows backend implementation (and stubs when not on Windows).
tools/system_metrics/src/os/macos_system_metrics.hxx macOS backend class declaration.
tools/system_metrics/src/os/macos_system_metrics.cxx macOS backend implementation (and stubs when not on macOS).
tools/system_metrics/src/os/linux_system_metrics.hxx Linux backend class declaration.
tools/system_metrics/src/os/linux_system_metrics.cxx Linux backend implementation (and stubs when not on Linux).
tools/system_metrics/include/system_metrics_reporter.hxx Public factory API for creating a backend instance.
tools/system_metrics/include/system_metrics.hxx Public API/types for process/system metrics collection.
tools/system_metrics/README.md High-level module notes and TODO.
tools/system_metrics/CMakeLists.txt Build definition for the system_metrics_cxx object library.
tools/sysinfo.hxx Declaration of the new cbc sysinfo command entry points.
tools/sysinfo.cxx Implementation of cbc sysinfo (text/JSON output, polling, signal handling).
tools/remove.hxx Add #pragma once and <memory> for command factory types.
tools/query.hxx Add #pragma once and <memory> for command factory types.
tools/pillowfight.hxx Add #pragma once and <memory> for command factory types.
tools/pillowfight.cxx Add <memory> include.
tools/keygen.hxx Add #pragma once and <memory> for command factory types.
tools/get.hxx Add #pragma once and <memory> for command factory types.
tools/config.hxx Add #pragma once and <memory> for command factory types.
tools/cbc.cxx Register sysinfo and refactor dispatch + debug-mode exception behavior.
tools/beam.hxx Add #pragma once and <memory> for command factory types.
tools/analytics.hxx Add #pragma once and <memory> for command factory types.
tools/CMakeLists.txt Add sysinfo.cxx, add system_metrics subdir, and link system_metrics_cxx into cbc.
core/meta/version.hxx Declare couchbase::core::meta::is_debug().
core/meta/version.cxx Implement is_debug() returning COUCHBASE_CXX_CLIENT_DEBUG_BUILD.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Copy link
Copy Markdown
Contributor

@thejcfactor thejcfactor left a comment

Choose a reason for hiding this comment

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

Wow!! This is clearly much better than what I originally got into FIT 😄. LGTM 👍

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.

3 participants