Date: Wed, 30 Aug 2000 12:20:28 -0600 From: Warner Losh <imp@village.org> Cc: Peter Radcliffe <pir@pir.net>, freebsd-mobile@FreeBSD.ORG Subject: Re: Fwd: Suggestion for laptop suspension Message-ID: <200008301820.MAA17686@harmony.village.org> In-Reply-To: Your message of "Wed, 30 Aug 2000 11:33:22 MDT." <200008301733.LAA17169@harmony.village.org> References: <200008301733.LAA17169@harmony.village.org> <20000830124804.A17183@pir.net> <20000830082712.A31339@sharmas.dhs.org> <200008300753.BAA14369@harmony.village.org> <XFMail.000830173512.doconnor@gsoft.com.au> <20000830082712.A31339@sharmas.dhs.org> <200008301550.e7UFoSG06876@billy-club.village.org>
next in thread | previous in thread | raw e-mail | index | archive | help
In message <200008301733.LAA17169@harmony.village.org> Warner Losh writes: : In message <20000830124804.A17183@pir.net> Peter Radcliffe writes: : : Whereas I noted on my Vaio that it suspends to disk considerably : : faster if it's just booted. It seems to be less blatant on my newer : : Z505HS, but it was quite obvious on my 505TR with 128Mb. : : I have a VAIO 505TS. I'll do timing later today, but I can detect no : difference in suspend time with it. : : I'll post a small program for testing purposes that writes 0's to : large hunks of memory as well as random bytes. OK. Here's what I did. I wrote a program, attached, and used it to zero or randomize chunks of memory. I timed this using date on another system, so the times are +- 1-2 seconds 0 16MB 64M 128M suspend zero 24 24 22 19 random 28 resume zero 56 57 50 48 random 60 OK. All numbers are +- 1 or 2 seconds due to my experimental setup. However, this does show a slight speedup for large blocks of zeros. And I do mean LARGE blocks of zeros. On the order of 10%-15% considering uncertainty and the small sample size (you need about 1500 samples to have a 99% confidence in the actual value, and I didn't want to do that) improvement. I did notice that I paid a heavy price for this. When I zeroed 128M, lots of things swapped out, and had to swap back into memory when I needed them. I have 128M of RAM on this box. The zero of 64MB of RAM took about 1-2 seconds (I didn't time it, but there was a pause), which negates at least some of the savings from the suspend. So if someone wants to write a driver that will flush trash memory in the kernel and measure the results, have fun. I just did the first order estimates here. The savings looks to be too small to be worth the effort, imho, but others can push this idea further if they feel like it. Warner /* * simple program to fill memory with zeros or random junk. * -s N -r -z * -s N allocate 2^N bytes * -r use random byte values (well, 1, 2, 3, ...) in the memory * -z user zeros in the memory * Released to the public domain AS IS. Fully understand the code * or do not run it. */ #include <string.h> #include <stdlib.h> #include <limits.h> #include <unistd.h> #include <err.h> #include <stdio.h> int main(int argc, char **argv) { char buffer[10]; /* Size doesn't matter */ int z_flag = 0; size_t size = 1 << 20; char *mem; size_t i; int ch; while ((ch = getopt(argc, argv, "rs:z")) != -1) { switch (ch) { case 'r': z_flag = 0; break; case 'z': z_flag = 1; break; case 's': size = 1 << strtoul(optarg, NULL, 0); break; } } printf("Allocating %d bytes\n", size); mem = malloc(size); if (!mem) err(1, "Cannot get %lu bytes", size); if (z_flag) memset(mem, 0, size); else for (i = 0; i < size; i++) mem[i] = i % 0xff; printf("Memory initialized. Press return to continue\n"); fgets(buffer, sizeof(buffer), stdin); free(mem); } To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-mobile" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200008301820.MAA17686>