File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change 2727#include  " ggml-cann.h" 
2828#endif 
2929
30+ #ifdef  _WIN32
31+ #define  WIN32_LEAN_AND_MEAN 
32+ #ifndef  NOMINMAX
33+ #   define  NOMINMAX 
34+ #endif 
35+ #include  < windows.h> 
36+ #endif 
37+ 
3038//  utils
3139static  uint64_t  get_time_ns () {
3240    using  clock = std::chrono::high_resolution_clock;
@@ -96,6 +104,27 @@ static std::string get_cpu_info() {
96104        }
97105        fclose (f);
98106    }
107+ #elif  defined(_WIN32)
108+     HKEY hKey;
109+     if  (RegOpenKeyEx (HKEY_LOCAL_MACHINE,
110+                      TEXT (" HARDWARE\\ DESCRIPTION\\ System\\ CentralProcessor\\ 0" 
111+                      0 ,
112+                      KEY_READ,
113+                      &hKey) != ERROR_SUCCESS) {
114+         //  fail to open registry key
115+         return  " " 
116+     }
117+     char  cpu_brand[256 ];
118+     DWORD cpu_brand_size = sizeof (cpu_brand);
119+     if  (RegQueryValueExA (hKey,
120+                         TEXT (" ProcessorNameString" 
121+                         NULL ,
122+                         NULL ,
123+                         (LPBYTE)cpu_brand,
124+                         &cpu_brand_size) == ERROR_SUCCESS) {
125+         id.assign (cpu_brand, cpu_brand_size);
126+     }
127+     RegCloseKey (hKey);
99128#endif 
100129    //  TODO: other platforms
101130    return  id;
 
 
   
 
     
   
   
          
    
    
     
    
      
     
     
    You can’t perform that action at this time.
  
 
    
  
    
      
        
     
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments