Skip to content

Pause and resume profiling? #32

@rask

Description

@rask

I want to profile our PHPUnit tests. I would like to limit profiling to test methods themselves, which would mean no data would be collected during bootstrapping and finding test cases to run. Simple example:

class MyTest extends TestCase
{
    public function setUp() : void
    {
        parent::setUp();

        memprof_enable();
    }

    public function tearDown() : void
    {
        memprof_disable();

        parent::tearDown();
    }

    ... test methods here ...
}

Then in a PHPUnit extension or similar, I would call memprof_dump_callgrind(...) to generate the dump file.

Problem is, when I call memprof_disable(), all collected data is lost, and the resulting dump is empty.

Is there any way to "pause and resume" memprof data collection, or am I stuck with polluting the dumps with "unrelated" code paths that are of no interest to me?

Can I build a new aggregate dump if I somehow combine dump data via memprof_dump_array(...), or will that result in strange values and invalid call paths?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions