Skip to content

Resolve regex library deprecation warnings #308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

emmanuel-ferdman
Copy link

PR Summary

This small PR resolves the regex library warnings showing starting Python3.11 which you can find in the CI logs:

/home/runner/work/perfmon/perfmon/scripts/create_perf_json.py:1542: DeprecationWarning: 'count' is passed as positional argument

@edwarddavidbaker
Copy link
Contributor

form = re.sub(r':USER', ':u', form, re.IGNORECASE)
form = re.sub(r':SUP', ':k', form, re.IGNORECASE)

Previous regex substitutions were accidentally passing passing flags into the count argument https://docs.python.org/3/library/re.html#re.sub .

re.sub(pattern, repl, string, count=0, flags=0)

This pull request does result in output differences.

diff -rup main/alderlaken/adln-metrics.json emmanuel-ferdman/alderlaken/adln-metrics.json
--- main/alderlaken/adln-metrics.json   2025-05-28 06:15:25.534862815 -0700
+++ emmanuel-ferdman/alderlaken/adln-metrics.json       2025-05-28 06:15:51.094856988 -0700
@@ -465,7 +465,7 @@
     },
     {
         "BriefDescription": "Fraction of cycles spent in Kernel mode",
-        "MetricExpr": "cpu@CPU_CLK_UNHALTED.CORE_P@k / CPU_CLK_UNHALTED.CORE",
+        "MetricExpr": "CPU_CLK_UNHALTED.CORE_P:k / CPU_CLK_UNHALTED.CORE",
         "MetricGroup": "Summary",
         "MetricName": "tma_info_system_kernel_utilization"
     },
diff -rup main/grandridge/grr-metrics.json emmanuel-ferdman/grandridge/grr-metrics.json
--- main/grandridge/grr-metrics.json    2025-05-28 06:15:28.094862273 -0700
+++ emmanuel-ferdman/grandridge/grr-metrics.json        2025-05-28 06:15:53.854856286 -0700
@@ -627,7 +627,7 @@
     },
     {
         "BriefDescription": "Fraction of cycles spent in Kernel mode",
-        "MetricExpr": "cpu@CPU_CLK_UNHALTED.CORE_P@k / CPU_CLK_UNHALTED.CORE",
+        "MetricExpr": "CPU_CLK_UNHALTED.CORE_P:k / CPU_CLK_UNHALTED.CORE",
         "MetricGroup": "Summary",
         "MetricName": "tma_info_system_kernel_utilization"
     },
diff -rup main/sierraforest/srf-metrics.json emmanuel-ferdman/sierraforest/srf-metrics.json
--- main/sierraforest/srf-metrics.json  2025-05-28 06:15:32.414861362 -0700
+++ emmanuel-ferdman/sierraforest/srf-metrics.json      2025-05-28 06:15:58.744854889 -0700
@@ -699,7 +699,7 @@
     },
     {
         "BriefDescription": "Fraction of cycles spent in Kernel mode",
-        "MetricExpr": "cpu@CPU_CLK_UNHALTED.CORE_P@k / CPU_CLK_UNHALTED.CORE",
+        "MetricExpr": "CPU_CLK_UNHALTED.CORE_P:k / CPU_CLK_UNHALTED.CORE",
         "MetricGroup": "Summary",
         "MetricName": "tma_info_system_kernel_utilization"
     },

@edwarddavidbaker
Copy link
Contributor

Thanks for opening a pull request @emmanuel-ferdman .

@emmanuel-ferdman
Copy link
Author

@edwarddavidbaker anything else is need from my side? thanks 🙌

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