Skip to content

Commit d4730fc

Browse files
committed
Remove memprof_enable() function
Enabling profiling during request may not work as expected because of PHP optimizations and observer behavior. Using MEMPROF_PROFILE is now the only way to enable profiling.
1 parent 846d71a commit d4730fc

File tree

9 files changed

+318
-88
lines changed

9 files changed

+318
-88
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ jobs:
1212
tests:
1313
name: 'Tests'
1414
strategy:
15+
fail-fast: false
1516
matrix:
1617
include:
1718
- php: '8.4.0'

memprof.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,28 +1791,6 @@ PHP_FUNCTION(memprof_memory_get_peak_usage)
17911791
}
17921792
/* }}} */
17931793

1794-
/* {{{ proto bool memprof_enable()
1795-
Enables memprof */
1796-
PHP_FUNCTION(memprof_enable)
1797-
{
1798-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "") == FAILURE) {
1799-
return;
1800-
}
1801-
1802-
if (MEMPROF_G(profile_flags).enabled) {
1803-
zend_throw_exception(EG(exception_class), "memprof_enable(): memprof is already enabled", 0);
1804-
return;
1805-
}
1806-
1807-
zend_error(E_WARNING, "Calling memprof_enable() manually may not work as expected because of PHP optimizations. Prefer using MEMPROF_PROFILE=1 as environment variable, GET, or POST");
1808-
1809-
MEMPROF_G(profile_flags).enabled = 1;
1810-
memprof_enable(&MEMPROF_G(profile_flags));
1811-
1812-
RETURN_TRUE;
1813-
}
1814-
/* }}} */
1815-
18161794
/* {{{ proto bool memprof_disable()
18171795
Disables memprof */
18181796
PHP_FUNCTION(memprof_disable)

memprof.stub.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ function memprof_enabled(): bool {}
99

1010
function memprof_enabled_flags(): array {}
1111

12-
function memprof_enable(): bool {}
13-
1412
function memprof_disable(): bool {}
1513

1614
function memprof_dump_array(): array {}

memprof_arginfo.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: afb43b76aec85442c7267aba0b45bfd00d5c8cf1 */
2+
* Stub hash: a8dec2138f524b2d8e0e5e07631e4965250fbbba */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_memprof_enabled, 0, 0, _IS_BOOL, 0)
55
ZEND_END_ARG_INFO()
66

77
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_memprof_enabled_flags, 0, 0, IS_ARRAY, 0)
88
ZEND_END_ARG_INFO()
99

10-
#define arginfo_memprof_enable arginfo_memprof_enabled
11-
1210
#define arginfo_memprof_disable arginfo_memprof_enabled
1311

1412
#define arginfo_memprof_dump_array arginfo_memprof_enabled_flags
@@ -25,7 +23,6 @@ ZEND_END_ARG_INFO()
2523

2624
ZEND_FUNCTION(memprof_enabled);
2725
ZEND_FUNCTION(memprof_enabled_flags);
28-
ZEND_FUNCTION(memprof_enable);
2926
ZEND_FUNCTION(memprof_disable);
3027
ZEND_FUNCTION(memprof_dump_array);
3128
ZEND_FUNCTION(memprof_dump_callgrind);
@@ -36,7 +33,6 @@ ZEND_FUNCTION(memprof_version);
3633
static const zend_function_entry ext_functions[] = {
3734
ZEND_FE(memprof_enabled, arginfo_memprof_enabled)
3835
ZEND_FE(memprof_enabled_flags, arginfo_memprof_enabled_flags)
39-
ZEND_FE(memprof_enable, arginfo_memprof_enable)
4036
ZEND_FE(memprof_disable, arginfo_memprof_disable)
4137
ZEND_FE(memprof_dump_array, arginfo_memprof_dump_array)
4238
ZEND_FE(memprof_dump_callgrind, arginfo_memprof_dump_callgrind)

memprof_legacy_arginfo.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: afb43b76aec85442c7267aba0b45bfd00d5c8cf1 */
2+
* Stub hash: a8dec2138f524b2d8e0e5e07631e4965250fbbba */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_memprof_enabled, 0, 0, 0)
55
ZEND_END_ARG_INFO()
66

77
#define arginfo_memprof_enabled_flags arginfo_memprof_enabled
88

9-
#define arginfo_memprof_enable arginfo_memprof_enabled
10-
119
#define arginfo_memprof_disable arginfo_memprof_enabled
1210

1311
#define arginfo_memprof_dump_array arginfo_memprof_enabled
@@ -23,7 +21,6 @@ ZEND_END_ARG_INFO()
2321

2422
ZEND_FUNCTION(memprof_enabled);
2523
ZEND_FUNCTION(memprof_enabled_flags);
26-
ZEND_FUNCTION(memprof_enable);
2724
ZEND_FUNCTION(memprof_disable);
2825
ZEND_FUNCTION(memprof_dump_array);
2926
ZEND_FUNCTION(memprof_dump_callgrind);
@@ -34,7 +31,6 @@ ZEND_FUNCTION(memprof_version);
3431
static const zend_function_entry ext_functions[] = {
3532
ZEND_FE(memprof_enabled, arginfo_memprof_enabled)
3633
ZEND_FE(memprof_enabled_flags, arginfo_memprof_enabled_flags)
37-
ZEND_FE(memprof_enable, arginfo_memprof_enable)
3834
ZEND_FE(memprof_disable, arginfo_memprof_disable)
3935
ZEND_FE(memprof_dump_array, arginfo_memprof_dump_array)
4036
ZEND_FE(memprof_dump_callgrind, arginfo_memprof_dump_callgrind)

package.xml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
<file name="INTERNALS.md" role="doc" />
4343
<file name="README.md" role="doc" />
4444
<dir name="tests">
45-
<file name="001.phpt" role="test" />
4645
<file name="002.phpt" role="test" />
4746
<file name="003.phpt" role="test" />
4847
<file name="004.phpt" role="test" />

tests/001.phpt

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)