Skip to content

Commit

Permalink
Merge pull request #3 from MrClock8163/dev
Browse files Browse the repository at this point in the history
v2.1.0
  • Loading branch information
MrClock8163 authored Oct 2, 2024
2 parents 2556235 + b7af1fd commit 8dc0dbc
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 5 deletions.
11 changes: 11 additions & 0 deletions AddonProfiler/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## [v2.1.0](https://github.com/MrClock8163/AddonProfiler/releases/tag/v2.1.0) (Blender 2.90 -> 4.2)

### Added

- Filter Time logging option

## [v2.0.0](https://github.com/MrClock8163/AddonProfiler/releases/tag/v2.0.0) (Blender 2.90 -> 4.2)

Initial release of the rewrite
2 changes: 1 addition & 1 deletion AddonProfiler/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author" : "MrClock, bd3d (originally), rubenmesserschmidt (initial fixes)",
"description" : "Monitor and capture add-on profiling data",
"blender" : (2, 90, 0),
"version" : (2, 0, 0),
"version" : (2, 1, 0),
"wiki_url" : "",
"tracker_url" : "https://github.com/MrClock8163/AddonProfiler/issues",
"category" : "Development",
Expand Down
2 changes: 1 addition & 1 deletion AddonProfiler/blender_manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ type = "add-on"
id = "AddonProfiler"
name = "Add-on Profiler"
tagline = "Monitor and capture add-on profiling data"
version = "2.0.0"
version = "2.1.0"
blender_version_min = "4.2.0"
website = "https://github.com/MrClock8163/AddonProfiler"
tags = ["Development"]
Expand Down
12 changes: 12 additions & 0 deletions AddonProfiler/props.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,18 @@ class APROF_PG_logging(bpy.types.PropertyGroup):
),
default='WHITELIST'
)
filter_time_enable: bpy.props.BoolProperty(
name="Filter Time",
description="Hide items under an execution time threshold"
)
filter_time_threshold: bpy.props.FloatProperty(
name="Threshold",
description="Filter cutoff threshold",
min=0,
soft_max=60,
precision=6,
step=0.0001
)


classes = (
Expand Down
6 changes: 6 additions & 0 deletions AddonProfiler/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,12 @@ def draw(self, context):
row.prop(props, "logger_details", expand=True)
layout.prop(props, "filter_module")

layout.label(text="Time Threshold:")
col_time = layout.column(align=True)
col_time.prop(props, "filter_time_enable", toggle=True)
if props.filter_time_enable:
col_time.prop(props, "filter_time_threshold")

layout.label(text="Exclude:")
row_filters = layout.row(align=True)
row_filters.prop(props, "filter_comp", text="Comprehension", toggle=True)
Expand Down
9 changes: 6 additions & 3 deletions AddonProfiler/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,14 @@ def logger_call(self, frame: types.FrameType, arg):
def logger_return(self, frame, arg):
file, name, key = self.logger_names(frame.f_code)

if key not in self.callstack:
start = self.callstack.pop(key, None)
if start is None:
return

log = ""
start = self.callstack.pop(key)
duration = (datetime.now() - start).total_seconds()
if duration <= self.settings.filter_time_threshold and self.settings.filter_time_enable:
return

if 'NAME' in self.settings.logger_details:
log += name
Expand All @@ -76,7 +79,7 @@ def logger_return(self, frame, arg):
log += " at %s" % start

if 'TIME' in self.settings.logger_details:
log += " in %0.9fs" % (datetime.now() - start).total_seconds()
log += " in %0.9fs" % duration

print(log)

Expand Down
Binary file modified images/img_logging.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified images/img_tool_panels.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8dc0dbc

Please sign in to comment.