darcs

Issue 99 wish: Memory-suite

Title wish: Memory-suite
Priority feature Status waiting-for
Milestone Resolved in
Superseder Nosy List darcs-devel, dmitry.kurochkin, kowey, mornfall, thorkilnaur, tommy
Assigned To
Topics Performance

Created on 2006-01-17.15:46:26 by igloo, last changed 2009-08-27.14:33:00 by admin.

Messages
msg380 (view) Author: igloo Date: 2006-01-17.15:46:26
The darcs repo

    http://urchin.earth.li/darcs/ian/memory/

contains a library that, when LD_PRELOADed, tracks memory usage over the
execution of a program. It isn't perfect, but it probably works well
enough.

As I mentioned a while ago on one of the lists, it would be really
useful to have a darcs memory-suite (and probably also time-suite) in
addition to the test-suite. The hardest part is actually finding the
peak memory usage of a program's execution, but the above library should
solve that.

The ideal situation would be to have a project-independent
memory/time-suite with an elegant (E?)DSL and an easy way to get a list
of commands to reproduce failures by hand, but some individual tests
hacked together would be better than nothing.

Thanks
Ian
msg388 (view) Author: droundy Date: 2006-01-18.11:35:32
On Tue, Jan 17, 2006 at 03:46:27PM +0000, Ian Lynagh wrote:
> ...
> contains a library that, when LD_PRELOADed, tracks memory usage over the
> execution of a program. It isn't perfect, but it probably works well
> enough.

I like this idea, and LD_PRELOAD does seem like a relatively fool-proof
approach.  Is LD_PRELOAD purely linux-specific?

> As I mentioned a while ago on one of the lists, it would be really useful
> to have a darcs memory-suite (and probably also time-suite) in addition
> to the test-suite. The hardest part is actually finding the peak memory
> usage of a program's execution, but the above library should solve that.

Indeed, it would seem that with this library we could moderately easily
write a shell script (or haskell program) that could be run with something
like

./test-memory 25m ./darcs foobar

which would run "./darcs foobar" and print the peak memory use, and would
also print "FAILED" if the memory use is greater than 25 megabytes.  Such a
script would then make it very easy to add tests to the memory suite.

When this is written and added to the Makefile, the remaining tough part
would seem to be generating largish repositories upon which to test
darcs--which would be a very useful feature to have, but could take some
thought.  Ideally, one would like to have a repo-generating program that
could generate repos with various lengths histories, size patches,
directory depths, numbers of files per directory, length files, etc.
-- 
David Roundy
http://www.darcs.net
msg389 (view) Author: igloo Date: 2006-01-18.13:44:40
On Wed, Jan 18, 2006 at 11:35:33AM +0000, David Roundy wrote:
> 
> David Roundy <droundy@darcs.net> added the comment:
> 
> On Tue, Jan 17, 2006 at 03:46:27PM +0000, Ian Lynagh wrote:
> > ...
> > contains a library that, when LD_PRELOADed, tracks memory usage over the
> > execution of a program. It isn't perfect, but it probably works well
> > enough.
> 
> I like this idea, and LD_PRELOAD does seem like a relatively fool-proof
> approach.  Is LD_PRELOAD purely linux-specific?

No, but it's not universal either. I'd expect most space bugs to exist
either everywhere or nowhere, though.

The best second OS to cover in order to catch as many bugs as possible
is probably Windows, but I have no idea how to do this sort of thing
there.

> > As I mentioned a while ago on one of the lists, it would be really useful
> > to have a darcs memory-suite (and probably also time-suite) in addition
> > to the test-suite. The hardest part is actually finding the peak memory
> > usage of a program's execution, but the above library should solve that.
> 
> Indeed, it would seem that with this library we could moderately easily
> write a shell script (or haskell program) that could be run with something
> like
> 
> ./test-memory 25m ./darcs foobar

Ah, I hadn't thought about passing a maximum in, good point. We can
probably get it to the library via an environment variable.

> which would run "./darcs foobar" and print the peak memory use,

I don't think it should print to stdout/stderr; currently it writes to a
file called data, although this could also be set via env vars. We might
want one file for the step by step mem usage and another for general
stats like peak memory usage.

> When this is written and added to the Makefile, the remaining tough part
> would seem to be generating largish repositories upon which to test
> darcs--which would be a very useful feature to have, but could take some
> thought.  Ideally, one would like to have a repo-generating program that
> could generate repos with various lengths histories, size patches,
> directory depths, numbers of files per directory, length files, etc.

This should be simple enough with a few bits of perl, like

perl -e 'print "Foo\n"x10000' > foo

(or the generating script could be a perl program itself.

Thanks
Ian
msg392 (view) Author: droundy Date: 2006-01-19.12:38:38
On Wed, Jan 18, 2006 at 01:44:41PM +0000, Ian Lynagh wrote:
> > Indeed, it would seem that with this library we could moderately easily
> > write a shell script (or haskell program) that could be run with something
> > like
> > 
> > ./test-memory 25m ./darcs foobar
> 
> Ah, I hadn't thought about passing a maximum in, good point. We can
> probably get it to the library via an environment variable.
>
> > which would run "./darcs foobar" and print the peak memory use,
> 
> I don't think it should print to stdout/stderr; currently it writes to a
> file called data, although this could also be set via env vars. We might
> want one file for the step by step mem usage and another for general
> stats like peak memory usage.

I was thinking of ./test-memory as a driver script, which would parse the
output file and then present it in a pretty manner to the caller (on
stdout).  Definitely the library should be dumping to a file, so we can
simultaneously check the values of stdout if we so desire.

> > When this is written and added to the Makefile, the remaining tough
> > part would seem to be generating largish repositories upon which to
> > test darcs--which would be a very useful feature to have, but could
> > take some thought.  Ideally, one would like to have a repo-generating
> > program that could generate repos with various lengths histories, size
> > patches, directory depths, numbers of files per directory, length
> > files, etc.
> 
> This should be simple enough with a few bits of perl, like
> 
> perl -e 'print "Foo\n"x10000' > foo
> 
> (or the generating script could be a perl program itself.

That'll handle a few files, but if we want to generate repositories with
entire directory structures and long histories--so that we could, for
example, check the memory usage of darcs changes -v, it would be nice to
stick have a nice framework (probably written in perl) for generating our
repositories.  The point of the framework being to allow us to change any
dimension we like of the repository to see how memory use or time scale
with that.  e.g. the length of files, number of files, size of changes
(i.e. just a few lines in a large files, or many separate hunks in each
file, or one huge hunk in each file), number of changes, etc.  There are so
many dimensions here, many of which critically will affect some time or
space inefficiency, that I'd like a unified way of specifying them.

If we were thorough enough, we'd then be able to create nice plots like
"time versus number of patches since the last tag upon which the inventory
is split, with everything else held fixed".
-- 
David Roundy
http://www.darcs.net
msg4808 (view) Author: kowey Date: 2008-05-21.10:45:30
Ian, if you have a spare moment, do you think you could turn this into reality,
i.e. as a part of the darcs darcs repository slash makefile?

We have four distinct bugs about memory consumption (see in particular issue622 ).

There is also the maybench project and its darcs benchmark... but here I do not
particularly care about generated tests.  Handwritten, reproducible ones would
be good.
msg4856 (view) Author: igloo Date: 2008-05-24.11:29:53
I don't expect to have a spare minute for this in the near future, sorry.
msg5616 (view) Author: kowey Date: 2008-08-20.13:40:59
If I understand Jason correctly, we need a volunteer to 'bake this into darcs
and use a reporting technique like ghc uses.Print "<<mmap: bytes allocated
:mmap>>" to stderr when --track-mmap is passed to darcs.'
msg8507 (view) Author: kowey Date: 2009-08-26.13:38:44
Does Petr's darcs-benchmark do what we want?

  http://hackage.haskell.org/package/darcs-benchmark

It prints memory use
History
Date User Action Args
2006-01-17 15:46:26igloocreate
2006-01-18 11:35:33droundysetstatus: unread -> unknown
nosy: droundy, tommy, igloo
messages: + msg388
2006-01-18 13:44:41igloosetnosy: droundy, tommy, igloo
messages: + msg389
2006-01-19 12:38:40droundysetnosy: droundy, tommy, igloo
messages: + msg392
2006-01-22 01:06:22droundysetnosy: droundy, tommy, igloo
2007-07-20 13:59:08koweysettopic: + Performance
nosy: + kowey, beschmi
2008-02-07 17:07:32markstossetstatus: unknown -> deferred
nosy: droundy, tommy, beschmi, kowey, igloo
title: Memory-suite -> wish: Memory-suite
2008-05-07 16:06:47koweysetstatus: deferred -> unknown
nosy: + dagit
2008-05-21 10:45:32koweysetnosy: droundy, tommy, beschmi, kowey, dagit, igloo
messages: + msg4808
assignedto: igloo
2008-05-24 11:29:54igloosetnosy: droundy, tommy, beschmi, kowey, dagit, igloo
messages: + msg4856
assignedto: igloo ->
2008-08-20 13:41:01koweysetstatus: unknown -> needs-reproduction
nosy: droundy, tommy, beschmi, kowey, dagit, igloo
messages: + msg5616
2009-08-06 17:32:23adminsetnosy: + markstos, jast, Serware, dmitry.kurochkin, darcs-devel, zooko, mornfall, simon, thorkilnaur, - droundy, igloo
2009-08-06 20:29:47adminsetnosy: - beschmi
2009-08-10 22:22:11adminsetnosy: + igloo, - markstos, darcs-devel, zooko, jast, Serware, mornfall
2009-08-11 00:20:31adminsetnosy: - dagit
2009-08-25 17:19:37adminsetnosy: + darcs-devel, - igloo
2009-08-25 17:47:09adminsetnosy: - simon
2009-08-26 13:38:46koweysetstatus: needs-reproduction -> waiting-for
nosy: + mornfall
messages: + msg8507
2009-08-27 14:33:00adminsetnosy: tommy, kowey, darcs-devel, thorkilnaur, dmitry.kurochkin, mornfall