Closed Bug 208935 Opened 23 years ago Closed 23 years ago

Add a small inline nsStopWatch helper class

Categories

(Core :: XPCOM, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: KaiE, Assigned: dougt)

Details

Attachments

(1 file)

Sometimes I want to do minimal timing, not using the overhead of the timeline service, with some printf statements. I have written a small inline class that provices milliseconds based timing, easy to use. I'm attaching the class, not sure whether we really should add it to XPCOM or to somewhere else. Also, I have not yet patched the makefiles to make this code available everywhere.
Attached file nsStopWatch.h
Using is as simple as nsStopWatch sw; sw.start(); sw.stop(); printf("%d", sw.get());
is this pattern used elsewhere? Can we remove code by moving something like this into xpcom?
I thought we had NS_TIMELINE stuff for that kind of thing?
I was looking for something simpler, I didn't want to go through the hassle to learn the timeline stuff. I was also unsure whether in the output, I would see lots of times from other components, that I'd had to sort out before I'd see my own times. I have used this code for myself. It served me well, and I'll continue to use it. If you don't want to check it in, no problem with me.
Woah. "I didn't want to go through the hassle to learn the timeline stuff." So by that logic, every time you need a component, you're going to write something new, rather than actually do the research to learn what existing stuff does? This is a very irresponsible attitude, and doesn't belong in an open source project - you're saying that 20 minutes of your own time is worth more than adding complexity to a codebase shared by hundreds of developers for the next n years? When you can provide solid evidence why NS_TIMELINE doesn't suit your needs, THEN I might take this request seriously.
This is a header only, that would usually only get used in debug builds, and I don't think it can be described as adding complexity. But I don't want to spend us more time on discussing this if we disagree. Let's wontfix it, I will continue to use it when I have to time simple things, and I will look into the timeline code as soon as I have to measure something more complex.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: