Merge pull request #2274 from esdrubal/udpclientreceive
[mono.git] / mono / utils / mono-proclib.c
index 05ff5b6d5c3c77cba8c6849054884393d1237c4b..c4e20e4ed42400bad8e38c6ddb3a8ff100d13b87 100644 (file)
@@ -161,7 +161,7 @@ mono_process_list (int *size)
                                count = 16;
                        else
                                count *= 2;
-                       buf = g_realloc (buf, count * sizeof (void*));
+                       buf = (void **)g_realloc (buf, count * sizeof (void*));
                }
                buf [i++] = GINT_TO_POINTER (pid);
        }
@@ -755,6 +755,15 @@ mono_atexit (void (*func)(void))
 #endif
 }
 
+/*
+ * This function returns the cpu usage in percentage,
+ * normalized on the number of cores.
+ *
+ * Warning : the percentage returned can be > 100%. This
+ * might happens on systems like Android which, for
+ * battery and performance reasons, shut down cores and
+ * lie about the number of active cores.
+ */
 gint32
 mono_cpu_usage (MonoCpuUsageState *prev)
 {
@@ -808,8 +817,5 @@ mono_cpu_usage (MonoCpuUsageState *prev)
        if (cpu_total_time > 0 && cpu_busy_time > 0)
                cpu_usage = (gint32)(cpu_busy_time * 100 / cpu_total_time);
 
-       g_assert (cpu_usage >= 0);
-       g_assert (cpu_usage <= 100);
-
        return cpu_usage;
 }