KLogger icon indicating copy to clipboard operation
KLogger copied to clipboard

Timer Methods

Open samstewart opened this issue 13 years ago • 6 comments

Hi, I added some simple timing methods and started work on a lightweight PHP profiler (KProfiler). Anyway, would love to make at least the timing methods available to everyone.

Keep up the good work!

Sam

samstewart avatar Jan 06 '12 04:01 samstewart

Cool, I like the addition of the timing functions, but I'd suggest perhaps storing the start time of a task in a hash table where the task name is the key?

Ie,

$this->_startTimes[$task] = $time

That way you can nest timings

Kenny Katzgrau Web: http://codefury.net Twitter: @kennyk Skype: kenny.katzgrau

On Thursday, January 5, 2012 at 11:01 PM, Sam Stewart wrote:

Hi, I added some simple timing methods and started work on a lightweight PHP profiler (KProfiler). Anyway, would love to make at least the timing methods available to everyone.

Keep up the good work!

Sam

You can merge this Pull Request by running:

git pull https://github.com/samstewart/KLogger master

Or you can view, comment on it, or merge it online at:

https://github.com/katzgrau/KLogger/pull/8

-- Commit Summary --

  • Added KProfiler and added new timing methods to KLogger.php
  • [tweak] tabs to spaces to match coding guidelines

-- File Changes --

M .gitignore (10) M example/example.php (17) M src/KLogger.php (47) A src/KProfiler.php (83)

-- Patch Links --

https://github.com/katzgrau/KLogger/pull/8.patch https://github.com/katzgrau/KLogger/pull/8.diff


Reply to this email directly or view it on GitHub: https://github.com/katzgrau/KLogger/pull/8

katzgrau avatar Jan 06 '12 04:01 katzgrau

Excellent point, I guess I assumed a sort of "stack based" call where every start call is matched with a finish call. However, there is a good chance a developer may start another timing call before finishing the last one.

I'll make the changes and push.

samstewart avatar Jan 06 '12 04:01 samstewart

Alright, I added the array as you suggested. I cleaned up the example file a bit.

samstewart avatar Jan 09 '12 02:01 samstewart

@katzgrau / @samstewart I know this is a very old PR but I do like this feature. Seeing as KLogger has evolved a lot since this PR was submitted, this needs to be reworked into the current version of KLogger.

@samstewart Up for the task or can someone else rework this? @katzgrau Would you still like to have this feature? :+1:

onno-vos-dev avatar Aug 19 '15 08:08 onno-vos-dev

@onno-vos-dev I like the feature too — would be OK adding it

katzgrau avatar Aug 19 '15 11:08 katzgrau

@katzgrau Unless @samstewart reports here in the next week or so, I'll try to get my hands dirty again on KLogger and implement this feature for the new version of KLogger.

onno-vos-dev avatar Aug 19 '15 11:08 onno-vos-dev