Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update how profiler enabled flag is checked #4621

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/clusterfuzz/_internal/bot/fuzzers/afl/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
from clusterfuzz._internal.bot.fuzzers.afl.fuzzer import write_dummy_file
from clusterfuzz._internal.fuzzing import strategy
from clusterfuzz._internal.metrics import logs
from clusterfuzz._internal.metrics import profiler
from clusterfuzz._internal.platforms import android
from clusterfuzz._internal.system import environment
from clusterfuzz._internal.system import new_process
Expand Down Expand Up @@ -1661,7 +1660,6 @@ def main(argv):
# same python process.
logs.configure('run_fuzzer')
_verify_system_config()
profiler.start_if_needed('afl_launcher')

build_directory = environment.get_value('BUILD_DIR')
fuzzer_path = engine_common.find_fuzzer_path(build_directory, target_name)
Expand Down
2 changes: 0 additions & 2 deletions src/clusterfuzz/_internal/bot/fuzzers/libFuzzer/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
from clusterfuzz._internal.bot.fuzzers.libFuzzer import stats
from clusterfuzz._internal.fuzzing import strategy
from clusterfuzz._internal.metrics import logs
from clusterfuzz._internal.metrics import profiler
from clusterfuzz._internal.system import environment
from clusterfuzz._internal.system import shell
from clusterfuzz.fuzz import engine
Expand Down Expand Up @@ -280,7 +279,6 @@ def fuzz(self, target_path, options, reproducers_dir, max_time):
Returns:
A FuzzResult object.
"""
profiler.start_if_needed('libfuzzer_fuzz')
libfuzzer.set_sanitizer_options(target_path)
runner = libfuzzer.get_runner(target_path)

Expand Down
8 changes: 5 additions & 3 deletions src/clusterfuzz/_internal/metrics/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,16 @@
# limitations under the License.
"""Profiling functions."""
from clusterfuzz._internal.base import utils
from clusterfuzz._internal.config import local_config
from clusterfuzz._internal.metrics import logs
from clusterfuzz._internal.system import environment


def start_if_needed(service):
"""Start Google Cloud Profiler if |USE_PYTHON_PROFILER| environment variable
is set."""
if not environment.get_value('USE_PYTHON_PROFILER'):
"""Start Google Cloud Profiler if profiling key in project config
is enabled."""
config = local_config.ProjectConfig()
if not config.get('profiling.enabled', False):
jonathanmetzman marked this conversation as resolved.
Show resolved Hide resolved
return True

project_id = utils.get_application_id()
Expand Down
Loading