Bench icon indicating copy to clipboard operation
Bench copied to clipboard

Include memory information when outputting Hoa\Bench.

Open evert opened this issue 10 years ago • 15 comments

This is a feature request. We're using Hoa\Bench to measure how slow we are for a number of things.

We manually also output PHP memory right at the bottom, as you can see here:

https://github.com/fruux/sabre-vobject/blob/master/bin/bench_freebusygenerator.php#L61

I was wondering if this could also be a good Hoa\Bench built-in feature =)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

evert avatar Jul 07 '15 20:07 evert

Measuring PHP memory is something really hard… I tried several times but without success :-/. The memory_* functions are not accurate since they are based on the memory allocated by the VM, not the current program. /cc @hoaproject/hoackers

Hywan avatar Jul 08 '15 14:07 Hywan

I guess for my use-case, accuracy is not the most important. Relative accuracy is. If I see a great increase in memory usage, the number is not as important as the fact that memory usage did increase. This is how I very recently discovered a big memory leak.

I'd actually suggest using the xdebug_ methods though.

evert avatar Jul 08 '15 15:07 evert

@evert If ext/xdebug yes, we could fallback to it. So, ok. Any volunteers in the @hoaproject/hoackers community?

Hywan avatar Jul 09 '15 05:07 Hywan

:+1:

vonglasow avatar Jul 10 '15 09:07 vonglasow

Hoa\Bench allow the possibility to make a pause during the process. But, memory benchmark will can't be paused.

vonglasow avatar Jul 13 '15 11:07 vonglasow

That's correct. We are not going to be able to pause the memory, but does it make sense after all? We land and start a new mark. We pause it, we unpause it later and we end it. What does it mean in term of memory? Just nothing. We can record the memory (and memory peak) on start and stop/pause, but when we unpause, what can we do? We could work relatively (total memory used = memory at time B - memory at time A + m_D - m_C).

Thoughts?

Hywan avatar Jul 13 '15 13:07 Hywan

Or… we can attach the memory information to the __global__ mark, which is started and stopped before and after all marks (thanks @camael24 for this feature!). It would make more sense.

The real answer is: @evert, does it answer to your needs?

Hywan avatar Jul 13 '15 13:07 Hywan

In the particular case I was looking at, knowing it globally would definitely help. But a peak/current memory usage after stop() would probably be useful in the future as well. Even if tests can be paused, this would at least give some sort of indication where it went wrong.

evert avatar Jul 13 '15 13:07 evert

@evert: Correct. In all cases, the __global__ mark is a regular one, as all the others.

So, any volunteers @hoaproject/hoackers? Maybe @evert, @vonglasow or @camael24?

Hywan avatar Jul 14 '15 06:07 Hywan

@dantleech Can you help us here please? I reckon your experience on PHPBench can be useful.

Hywan avatar Feb 24 '16 07:02 Hywan

PHPBench simply disables GC and records memory_get_peak_usage (here].

dantleech avatar Feb 24 '16 07:02 dantleech

@dantleech Since Hoa\Bench can put marks in pause, how do you think it can be applied on memory usage?

Hywan avatar Feb 24 '16 07:02 Hywan

@dantleech ping ?

vonglasow avatar Jul 26 '17 11:07 vonglasow

@vonglasow I am assigning this issue to you. Is it OK?

Hywan avatar Aug 07 '17 08:08 Hywan

@Hywan yes ok

vonglasow avatar Aug 07 '17 11:08 vonglasow