Re: your mail

Rik van Riel
2002-09-14T17:01:17Z

On Sat, 14 Sep 2002, Paolo Ciarrocchi wrote:

> I think that only the _memload_ test is not
> working with 2.5.*, am I wrong?

You're right, the memload test doesn't work with 2.5 but
needs the following patch...

Rik
--
Bravely reimplemented by the knights who say "NIH".

http://www.surriel.com/ http://distro.conectiva.com/

Spamtraps of the month: september@surriel.com trac@trac.org

--- contest-0.1/mem_load.c.orig 2002-09-13 23:36:47.000000000 -0400
+++ contest-0.1/mem_load.c 2002-09-14 11:10:07.000000000 -0400
@@ -47,24 +47,25 @@
switch (type) {

case 0: /* RAM */
- if ((position = strstr(buffer, "Mem:")) == (char *) NULL) {
- fprintf (stderr, "Can't parse \"Mem:\" in /proc/meminfo\n");
+ if ((position = strstr(buffer, "MemTotal:")) == (char *) NULL) {
+ fprintf (stderr, "Can't parse \"MemTotal:\" in /proc/meminfo\n");
exit (-1);
}
- sscanf (position, "Mem: %ul", &size);
+ sscanf (position, "MemTotal: %ul", &size);
break;

case 1:
- if ((position = strstr(buffer, "Swap:")) == (char *) NULL) {
- fprintf (stderr, "Can't parse \"Swap:\" in /proc/meminfo\n");
+ if ((position = strstr(buffer, "SwapTotal:")) == (char *) NULL) {
+ fprintf (stderr, "Can't parse \"SwapTotal:\" in /proc/meminfo\n");
exit (-1);
}
- sscanf (position, "Swap: %ul", &size);
+ sscanf (position, "SwapTotal: %ul", &size);
break;

}

- return (size / MB);
+ /* convert from kB to MB */
+ return (size / KB);

}

--- contest-0.1/mem_load.h.orig 2002-09-14 11:09:28.000000000 -0400
+++ contest-0.1/mem_load.h 2002-09-14 11:09:42.000000000 -0400
@@ -24,6 +24,7 @@

#define MAX_BUF_SIZE 1024 /* size of /proc/meminfo in bytes */
#define MB (1024 * 1024) /* 2^20 bytes */
+#define KB 1024
#define MAX_MEM_IN_MB (1024 * 64) /* 64 GB */

/* Tuning parameter. Increase if you are getting an 'unreasonable' load