Skip to content
This repository has been archived by the owner on Sep 20, 2021. It is now read-only.

Include memory information when outputting Hoa\Bench. #27

Open
evert opened this issue Jul 7, 2015 · 15 comments
Open

Include memory information when outputting Hoa\Bench. #27

evert opened this issue Jul 7, 2015 · 15 comments

Comments

@evert
Copy link

evert commented Jul 7, 2015

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.

@Hywan
Copy link
Member

Hywan commented Jul 8, 2015

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

@evert
Copy link
Author

evert commented Jul 8, 2015

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.

@Hywan
Copy link
Member

Hywan commented Jul 9, 2015

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

@vonglasow
Copy link
Member

👍

@vonglasow
Copy link
Member

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

@Hywan
Copy link
Member

Hywan commented Jul 13, 2015

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
Copy link
Member

Hywan commented Jul 13, 2015

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?

@evert
Copy link
Author

evert commented Jul 13, 2015

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.

@Hywan
Copy link
Member

Hywan commented Jul 14, 2015

@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
Copy link
Member

Hywan commented Feb 24, 2016

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

@dantleech
Copy link

PHPBench simply disables GC and records memory_get_peak_usage (here].

@Hywan
Copy link
Member

Hywan commented Feb 24, 2016

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

@vonglasow
Copy link
Member

@dantleech ping ?

@Hywan Hywan assigned vonglasow and unassigned Hywan Aug 7, 2017
@Hywan
Copy link
Member

Hywan commented Aug 7, 2017

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

@vonglasow
Copy link
Member

@Hywan yes ok

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Development

No branches or pull requests

4 participants