Help with measuring sleep delay.


I'm trying to measure the time it takes for the BeagleBoard to be put
into suspend to RAM -sleep. The problem is that the time seems to vary
a lot from time to time. If I run my sleeping script several times in
a row it only takes a fraction of the time that it takes if I run a
command (any command) in between. On the other hand, if I modify the
script so that it runs some commands before putting it to sleep it
will still fall to sleep extremely fast.

I started looking at the Linux ACPI code, but I have not really got a
clear view of what causes the variation. I came across a "sys_sync();"
call, which sounds like something that could cause this. The only
thing I've been able to find out about this function is that it "syncs
the file systems".

Does anyone know more about this? What could cause my problem? What
does the ACPI really do to suspend to RAM? What does sys_sync do?

I'm very thankful for any response.

- Jens

There are a number of write behind caches associated with the file system, and some other subsystems. These vary by the amount of changes, the type of changes, and the time since previous sync, most systems are configured to sync at minute intervals, but that is configured differently based on the distro. Certain types of writes are cached until a little bit later to try to combine sequential writes and other things. It makes a huge difference on system performance. Anyway it is a write behind cache that needs to be written at such times. On larger systems it can take minutes to complete these items.

Yes, the tests I've done seem to support what you are writing. The
syncing has a huge impact on the results and is the reason for the
huge variance.

Thanks a lot for your help!