K/s on preloader?

How would you do it? I imagine the code would be something like
var bytesLastLoaded = 0;
fps = 20;
loaded = _root.getBytesLoaded();
speed = (loaded - bytesLastLoaded)*fps;
bytesLastLoaded = loaded;

Would something like this work or is there a better way to do it? Ideally I wouldn’t use fps, I would use setInterval but this was what I just pulled out of my head a second ago. I guess I could also use getTimer somehow