-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
DOCSP-8667: Add performance reporting system
- Loading branch information
Showing
5 changed files
with
112 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,4 @@ node_modules/ | |
htmlcov/ | ||
.venv/ | ||
dist/ | ||
test_data/docs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import sys | ||
import logging | ||
from pathlib import Path | ||
from typing import Dict, List | ||
from .parser import Project | ||
from .types import Diagnostic, Page, FileId, SerializableType, BuildIdentifierSet | ||
from .util import PerformanceLogger | ||
|
||
logging.basicConfig(level=logging.INFO) | ||
|
||
|
||
class Backend: | ||
def on_progress(self, progress: int, total: int, message: str) -> None: | ||
pass | ||
|
||
def on_diagnostics(self, path: FileId, diagnostics: List[Diagnostic]) -> None: | ||
pass | ||
|
||
def on_update( | ||
self, | ||
prefix: List[str], | ||
build_identifiers: BuildIdentifierSet, | ||
page_id: FileId, | ||
page: Page, | ||
) -> None: | ||
pass | ||
|
||
def on_update_metadata( | ||
self, | ||
prefix: List[str], | ||
build_identifiers: BuildIdentifierSet, | ||
field: Dict[str, SerializableType], | ||
) -> None: | ||
pass | ||
|
||
def on_delete(self, page_id: FileId, build_identifiers: BuildIdentifierSet) -> None: | ||
pass | ||
|
||
|
||
def main() -> None: | ||
backend = Backend() | ||
root_path = Path(sys.argv[1]) | ||
project = Project(root_path, backend, {}) | ||
|
||
n_runs = 3 | ||
for i in range(n_runs): | ||
print(f"run {i+1}/{n_runs}") | ||
project.build(1) | ||
|
||
for name, time in PerformanceLogger.singleton().times().items(): | ||
print(f"{name}:{time:10.4}") | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters