Blender internals tracing #6161

Closed
opened 2007-03-04 15:06:04 +01:00 by Early Ehlinger · 3 comments

%%%==== Purpose: ====
This patch introduces 3 Blender.Set-based variables to allow python scripts to get verbose feedback of the progress of certain functions sent to the terminal/console . It is designed to be extensible, filterable, and quiet by default.

Why?

The initial set of traces provided in the patch are useful for producing highly verbose progress messages during a render session. These can be captured on a render farm and sent to a central render log for later analysis, for example.

It is our hope that additional trace groups are added by developers of various subsystems in the future, e.g., for fluidsim, physics calculations, etc., so that if somebody wants verbose progress messages, they can get them.

Usage:
To turn on tracing, one would write a Python script similar to this:

def traceCallback( sFile , nLine , sMessage , nFilter ):
  print sFile , "(" , nLine , ") [" , nFilter , "] - " , sMessage;
import Blender;
Blender.Set( "traceCallback" , traceCallback );

To turn tracing off, the script would then do this:

Blender.Set( "traceCallback" , None );

You can enable/disable specific groups of callbacks as well:

Blender.Set( "traceFilterOn"  , 0 ); # turn on debug messages.
Blender.Set( "traceFilterOff" , 0 ); # turn off debug messages.
Blender.Set( "traceFilterOn"  , 1 ); # turn on render progress messages.
Blender.Set( "traceFilterOff" , 1 ); # turn off render progress messages.

There are 3 groups provided in this patch:
0 - debug
1 - render progress
2 - unpack progress

Patch Details:
This patch comes in the form of a .zip file, because I assume I do not have permission to add a .h file to the repository. unzip it in the root of the blender source tree (right above the blender and lib folders), and the Blender_Trace.h file should go in the right spot.

The other file in the patch is a standard cvs diff -b -u > blender_trace.patch

The main file affected is the python/2_2x/Blender.c file. This patch adds 2 global variables: g_blender_trace_callback, and g_blender_trace_filter- [ ]. It also adds a function, Blender_Trace, that can be called like printf to route messages to g_blender_trace_callback (a python function), and the hooks to access this functionality from Python.

Rationale
I originally planned to have traceFilter take a "bitwise-or"'d group of flags that would then be stored and compared during a call to Blender_Trace. Upon further consideration, I decided to have traceFilter represent an array of groups rather than a bit-flag since there is the potential for wanting more than 32 or even 64 individual groups.

%%%

%%%==== Purpose: ==== This patch introduces 3 Blender.Set-based variables to allow python scripts to get verbose feedback of the progress of certain functions sent to the terminal/console . It is designed to be extensible, filterable, and quiet by default. **Why?** The initial set of traces provided in the patch are useful for producing highly verbose progress messages during a render session. These can be captured on a render farm and sent to a central render log for later analysis, for example. It is our hope that additional trace groups are added by developers of various subsystems in the future, e.g., for fluidsim, physics calculations, etc., so that if somebody wants verbose progress messages, they can get them. **Usage:** To turn on tracing, one would write a Python script similar to this: ``` def traceCallback( sFile , nLine , sMessage , nFilter ): print sFile , "(" , nLine , ") [" , nFilter , "] - " , sMessage; ``` ``` import Blender; Blender.Set( "traceCallback" , traceCallback ); ``` To turn tracing off, the script would then do this: ``` Blender.Set( "traceCallback" , None ); ``` You can enable/disable specific groups of callbacks as well: ``` Blender.Set( "traceFilterOn" , 0 ); # turn on debug messages. Blender.Set( "traceFilterOff" , 0 ); # turn off debug messages. ``` ``` Blender.Set( "traceFilterOn" , 1 ); # turn on render progress messages. Blender.Set( "traceFilterOff" , 1 ); # turn off render progress messages. ``` There are 3 groups provided in this patch: 0 - debug 1 - render progress 2 - unpack progress **Patch Details:** This patch comes in the form of a .zip file, because I assume I do not have permission to add a .h file to the repository. unzip it in the root of the blender source tree (right above the blender and lib folders), and the Blender_Trace.h file should go in the right spot. The other file in the patch is a standard cvs diff -b -u > blender_trace.patch The main file affected is the python/2_2x/Blender.c file. This patch adds 2 global variables: g_blender_trace_callback, and g_blender_trace_filter- [ ]. It also adds a function, Blender_Trace, that can be called like printf to route messages to g_blender_trace_callback (a python function), and the hooks to access this functionality from Python. **Rationale** I originally planned to have traceFilter take a "bitwise-or"'d group of flags that would then be stored and compared during a call to Blender_Trace. Upon further consideration, I decided to have traceFilter represent an array of groups rather than a bit-flag since there is the potential for wanting more than 32 or even 64 individual groups. %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'

%%%for 2.6x we have a progress callback in the render api. further, I find this patch more intrusive then I'd like to be adding into blenders code.

closing.%%%

%%%for 2.6x we have a progress callback in the render api. further, I find this patch more intrusive then I'd like to be adding into blenders code. closing.%%%

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Sign in to join this conversation.
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender-addons#6161
No description provided.