Skip to content
Open
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
23 changes: 23 additions & 0 deletions applications/rtkargumentparser.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@
import inspect
from typing import Optional


def _enable_global_resource_probe_if_available(verbose: bool) -> None:
if not verbose:
return

# Mirror the C++ apps: --verbose enables RTK probe reporting (when compiled in).
try:
grp = getattr(rtk, "GlobalResourceProbe", None)
if grp is None:
return

instance = grp.GetInstance() if hasattr(grp, "GetInstance") else grp.New()
if hasattr(instance, "SetVerbose"):
instance.SetVerbose(True)
elif hasattr(instance, "VerboseOn"):
instance.VerboseOn()
except Exception:
# Keep --verbose best-effort and never fail the application.
return


__all__ = ["RTKArgumentParser"]


Expand Down Expand Up @@ -97,6 +118,8 @@ def parse_args(self, args=None, namespace=None):
# Case 2: normal space-separated form (e.g. "1 2 3"). Just cast every token.
setattr(namespace, dest, [caster(tk) for tk in val])
action.type = neutralized[dest]

_enable_global_resource_probe_if_available(getattr(namespace, "verbose", False))
return namespace

def parse_kwargs(self, func_name: Optional[str] = None, **kwargs):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ cmake.version = ">=3.16.3"
cmake.args = []

# A table of defines to pass to CMake when configuring the project. Additive.
cmake.define = {}
cmake.define = { RTK_PROBE_EACH_FILTER = "ON" }

# Verbose printout when building.
cmake.verbose = true
Expand Down
Loading