Skip to content

Windows/WSL: TDP finder — regex y selección de columna (Base/Max/Turbo) para evitar valores no‐string/NaN #2

@JessicaFM

Description

@JessicaFM

Descripción

Al ejecutar el TDP finder en Windows 11 + WSL (Ubuntu 22.04), el campo TDP puede venir como NaN o como número (no string) desde el CSV externo (cpu-spec-dataset). Con la expresión regular actual y la selección de columna, el parseo puede fallar o resultar ambiguo.

He probado un ajuste mínimo en mi fork que corrige la regex y prioriza columnas de potencia con un fallback si el valor principal es NaN.

Cambio aplicado (mi fork)

Commit de referencia: ddb8f70

diff --git a/execution_process_metrics_collector/tdp_finder.py b/execution_process_metrics_collector/tdp_finder.py
index b91cb6e..7b9bb4c 100644
--- a/execution_process_metrics_collector/tdp_finder.py
+++ b/execution_process_metrics_collector/tdp_finder.py
@@ -52,8 +52,16 @@ def tdp_finder(series_dir: "pathlib.Path", processors_file: "pathlib.Path") -> "
 
     tdp_str = cpus[
         cpus["ProcessorNumber"].apply(lambda pn: str(pn) in model_name)
-    ].ConfigTDPMax.values[0]
-    matched = re.search(r"^([0-9]+(?:\.[0-9]+])?) W", tdp_str)
+    ].ProcessorBasePower.values[0]
+    if str(tdp_str).strip().lower() == "nan":
+        tdp_str = cpus[
+            cpus["ProcessorNumber"].apply(lambda pn: str(pn) in model_name)
+        ].MaxTurboPower.values[0]
+
+    # corrige la regex y asegura string
+    tdp_str = str(tdp_str)
+    matched = re.search(r"(\d+(?:\.\d+)?)", tdp_str)

cpu_details.json de mi entorno (copiar/guardar y usar como serie mínima):

[
  {
    "processor": "0",
    "vendor_id": "GenuineIntel",
    "cpu family": "6",
    "model": "186",
    "model name": "13th Gen Intel(R) Core(TM) i7-1365U",
    "stepping": "3",
    "microcode": "0xffffffff",
    "cpu MHz": "2688.011",
    "cache size": "12288 KB",
    "physical id": "0",
    "siblings": "4",
    "core id": "0",
    "cpu cores": "2",
    "apicid": "0",
    "initial apicid": "0",
    "fpu": "yes",
    "fpu_exception": "yes",
    "cpuid level": "21",
    "wp": "yes",
    "flags": "fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology cpuid tsc_known_freq pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 movbe popcnt aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced fsgsbase bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves umip gfni vaes vpclmulqdq rdpid fsrm md_clear flush_l1d arch_capabilities",
    "bugs": "spectre_v1 spectre_v2 spec_store_bypass swapgs mmio_unknown retbleed eibrs_pbrsb rfds bhi",
    "bogomips": "5376.02",
    "clflush size": "64",
    "cache_alignment": "64",
    "address sizes": "46 bits physical, 48 bits virtual",
    "power management": "",
    "processors": ["0","1","2","3"]
  }
]

mi output:

TDP => 28.0 W ???

Entorno:

Entorno

Windows 11 + WSL2 (Ubuntu 22.04), Python 3.10.12

Host: Dell Latitude 7440 — 12 procesadores lógicos

cpu_details.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions