Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
5 changes: 5 additions & 0 deletions codeflash/api/aiservice.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time

import json
import os
import platform
Expand Down Expand Up @@ -95,6 +97,7 @@ def optimize_python_code(
- List[OptimizationCandidate]: A list of Optimization Candidates.

"""
start_time = time.perf_counter()
payload = {
"source_code": source_code,
"dependency_code": dependency_code,
Expand All @@ -118,6 +121,8 @@ def optimize_python_code(
optimizations_json = response.json()["optimizations"]
logger.info(f"Generated {len(optimizations_json)} candidates.")
console.rule()
end_time = time.perf_counter()
logger.info(f"Optimization took {end_time - start_time:.2f} seconds.")
return [
OptimizedCandidate(
source_code=opt["source_code"],
Expand Down
5 changes: 5 additions & 0 deletions codeflash/verification/concolic_testing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time

import ast
import subprocess
import tempfile
Expand All @@ -20,6 +22,7 @@
def generate_concolic_tests(
test_cfg: TestConfig, args: Namespace, function_to_optimize: FunctionToOptimize, function_to_optimize_ast: ast.AST
) -> tuple[dict[str, list[FunctionCalledInTest]], str]:
start_time = time.perf_counter()
function_to_concolic_tests = {}
concolic_test_suite_code = ""
if (
Expand Down Expand Up @@ -84,4 +87,6 @@ def generate_concolic_tests(
else:
logger.debug(f"Error running CrossHair Cover {': ' + cover_result.stderr if cover_result.stderr else '.'}")
console.rule()
end_time = time.perf_counter()
logger.info(f"Generated concolic tests in {end_time - start_time:.2f} seconds")
return function_to_concolic_tests, concolic_test_suite_code
6 changes: 5 additions & 1 deletion codeflash/verification/verifier.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from __future__ import annotations

import time

import ast
from pathlib import Path
from typing import TYPE_CHECKING
Expand Down Expand Up @@ -29,6 +31,7 @@ def generate_tests(
) -> tuple[str, str, Path] | None:
# TODO: Sometimes this recreates the original Class definition. This overrides and messes up the original
# class import. Remove the recreation of the class definition
start_time = time.perf_counter()
test_module_path = Path(module_name_from_file_path(test_path, test_cfg.tests_project_rootdir))
response = aiservice_client.generate_regression_tests(
source_code_being_tested=source_code_being_tested,
Expand All @@ -54,7 +57,8 @@ def generate_tests(
else:
logger.warning(f"Failed to generate and instrument tests for {function_to_optimize.function_name}")
return None

end_time = time.perf_counter()
logger.info(f"Generated tests in {end_time - start_time:.2f} seconds")
return (
generated_test_source,
instrumented_behavior_test_source,
Expand Down
Loading