Skip to content

Commit fc8f88a

Browse files
authored
[k2] log built-in calls in tests (#1550)
1 parent 1a95921 commit fc8f88a

7 files changed

Lines changed: 484 additions & 5 deletions

File tree

compiler/code-gen/vertex-compiler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ void compile_func_call(VertexAdaptor<op_func_call> root, CodeGenerator &W, func_
917917
}
918918

919919
if (is_function_call_should_be_tracked(func)) {
920-
W << "SAVE_BUILTIN_CALL_STATS(\"" << func->name << "\", (";
920+
W << "DUMP_BUILTIN_CALL_STATS(\"" << func->name << "\", (";
921921
}
922922

923923
if (mode == func_call_mode::fork_call) {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Compiler for PHP (aka KPHP)
2+
// Copyright (c) 2026 LLC «V Kontakte»
3+
// Distributed under the GPL v3 License, see LICENSE.notice.txt
4+
5+
#pragma once
6+
7+
#include "runtime-light/stdlib/diagnostics/logs.h"
8+
9+
#define DUMP_BUILTIN_CALL_STATS(builtin_name, builtin_call) (kphp::log::debug("built-in called: " builtin_name), builtin_call)

runtime/runtime-builtin-stats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ inline void save_virtual_builtin_call_stats(const kphp::stl::string<kphp::memory
4949
}
5050
} // namespace runtime_builtins_stats
5151

52-
#define SAVE_BUILTIN_CALL_STATS(builtin_name, builtin_call) \
52+
#define DUMP_BUILTIN_CALL_STATS(builtin_name, builtin_call) \
5353
(!runtime_builtins_stats::request_stats.has_value() ? 0 : (*runtime_builtins_stats::request_stats).builtin_stats[std::string_view(builtin_name)]++, \
5454
builtin_call)

tests/kphp_tester.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def set_up_env_for_k2(self):
7575
self.env_vars["KPHP_ENABLE_GLOBAL_VARS_MEMORY_STATS"] = "0"
7676
self.env_vars["KPHP_PROFILER"] = "0"
7777
self.env_vars["KPHP_FORCE_LINK_RUNTIME"] = "1"
78+
self.env_vars["KPHP_TRACKED_BUILTINS_LIST"] = KphpRunOnce.K2_KPHP_TRACKED_BUILTINS_LIST
7879

7980

8081
def make_test_file(file_path, test_tmp_dir, test_tags):

0 commit comments

Comments
 (0)