On Friday, September 02, 2011 04:58:46 zeljkog wrote:
> Marco Leise Wrote:
> > void main(string[] args)
> > {
> >
> > if (!enforce(args.length == 3, {
> >
> > stderr.writefln("%s SOURCE DEST", args[0]);
> >
> > })) return;
> >
> > auto sw = StopWatch();
> > sw.start();
> >
> > auto src = new MmFile(args[1], MmFile.Mode.Read, 0, null, 0);
> > auto dst = new MmFile(args[2], MmFile.Mode.ReadWriteNew,
> > src.length,
> >
> > null, src.length);
> >
> > auto data = dst[];
> > data[] = src[];
> > dst.flush();
> >
> > sw.stop();
> > writefln("Copied %s bytes in %s msec (%s kB/s)", src.length,
> >
> > sw.peek().msecs,
> >
> > 1_000_000 * src.length / (1024 *
> > sw.peek().usecs));
> >
> > }
> >
> > - Marco
>
> Looking at this code, should be StopWatch.peek() defined as property?
Why? It's name isn't a noun, and conceptually, it's not really a property.
You're "peeking" at the current time elapsed. That's very much an action, not
a property.
- Jonathan M Davis