[wbemprox] Patches for adding currentclockspeed in record_processor

Rosen Diankov rosen.diankov at gmail.com
Tue Jul 2 06:34:06 CDT 2013


you are right again, i'll be more careful. now, i've addressed every
problem except creating the patches with git. any help would be
appreciated.
.



2013/7/2 Hans Leidekker <hans at codeweavers.com>:
> On Mon, 2013-07-01 at 18:08 +0900, Rosen Diankov wrote:
>> you are right, i'm attaching a new patch.
>
> You didn't address all comments.
>
>
-------------- next part --------------
--- wine-1.6-rc4-old/dlls/wbemprox/builtin.c	2013-06-29 04:53:55.000000000 +0900
+++ wine-1.6-rc4/dlls/wbemprox/builtin.c	2013-07-02 19:30:39.157916619 +0900
@@ -168,6 +168,8 @@
     {'M','a','n','u','f','a','c','t','u','r','e','r',0};
 static const WCHAR prop_maxclockspeedW[] =
     {'M','a','x','C','l','o','c','k','S','p','e','e','d',0};
+static const WCHAR prop_currentclockspeedW[] =
+    {'C','u','r','r','e','n','t','C','l','o','c','k','S','p','e','e','d',0};
 static const WCHAR prop_memberW[] =
     {'M','e','m','b','e','r',0};
 static const WCHAR prop_methodW[] =
@@ -381,6 +383,7 @@
     { prop_familyW,               CIM_UINT16, VT_I4 },
     { prop_manufacturerW,         CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_maxclockspeedW,        CIM_UINT32, VT_I4 },
+    { prop_currentclockspeedW,    CIM_UINT32, VT_I4 },
     { prop_nameW,                 CIM_STRING|COL_FLAG_DYNAMIC },
     { prop_numcoresW,             CIM_UINT32, VT_I4 },
     { prop_numlogicalprocessorsW, CIM_UINT32, VT_I4 },
@@ -633,6 +636,7 @@
     UINT16       family;
     const WCHAR *manufacturer;
     UINT32       maxclockspeed;
+    UINT32       currentclockspeed;
     const WCHAR *name;
     UINT32       num_cores;
     UINT32       num_logical_processors;
@@ -1690,20 +1694,30 @@
         regs_to_str( regs, 16, name + 32 );
     }
 }
-static UINT get_processor_maxclockspeed( void )
+static void get_processor_clockspeeds( UINT* maxclockspeed, UINT* currentclockspeed )
 {
     PROCESSOR_POWER_INFORMATION *info;
-    UINT ret = 1000, size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
+    UINT size = get_processor_count() * sizeof(PROCESSOR_POWER_INFORMATION);
     NTSTATUS status;
-
+    UINT valueswritten=0;
     if ((info = heap_alloc( size )))
     {
         status = NtPowerInformation( ProcessorInformation, NULL, 0, info, size );
-        if (!status) ret = info[0].MaxMhz;
+        if (!status)
+        {
+            *maxclockspeed = info[0].MaxMhz;
+            *currentclockspeed = info[0].CurrentMhz;
+            valueswritten = 1;
+        }
         heap_free( info );
     }
-    return ret;
+    if( valueswritten == 0 )
+    {
+        *maxclockspeed = 1000;
+        *currentclockspeed = 1000;
+    }
 }
+
 static const WCHAR *get_osarchitecture(void)
 {
     SYSTEM_INFO info;
@@ -1717,7 +1731,7 @@
     static const WCHAR fmtW[] = {'C','P','U','%','u',0};
     WCHAR device_id[14], processor_id[17], manufacturer[13], name[49] = {0};
     struct record_processor *rec;
-    UINT i, offset = 0, maxclockspeed, num_cores, num_logical_processors, count = get_processor_count();
+    UINT i, offset = 0, maxclockspeed = 0, currentclockspeed = 0, num_cores, num_logical_processors, count = get_processor_count();
     enum fill_status status = FILL_STATUS_UNFILTERED;
 
     if (!resize_table( table, count, sizeof(*rec) )) return FILL_STATUS_FAILED;
@@ -1725,8 +1739,8 @@
     get_processor_id( processor_id );
     get_processor_manufacturer( manufacturer );
     get_processor_name( name );
-
-    maxclockspeed = get_processor_maxclockspeed();
+    
+    get_processor_clockspeeds(&maxclockspeed, &currentclockspeed);
     num_logical_processors = get_logical_processor_count( &num_cores ) / count;
     num_cores /= count;
 
@@ -1740,6 +1754,7 @@
         rec->family                 = 2; /* Unknown */
         rec->manufacturer           = heap_strdupW( manufacturer );
         rec->maxclockspeed          = maxclockspeed;
+        rec->currentclockspeed      = currentclockspeed;
         rec->name                   = heap_strdupW( name );
         rec->num_cores              = num_cores;
         rec->num_logical_processors = num_logical_processors;


More information about the wine-devel mailing list