Skip to content
swax edited this page Aug 2, 2012 · 2 revisions

The Code Perspective viewer is initialized when an exe or dll that has been XRayed starts up. The Viewer can be closed anytime to reduce CPU usage while continuing to track the application. The Viewer can be started back up again from the Monitor tab in XBuilder.exe.

Main Display

Breadcrumbs

At the top of the viewer are breadcrumbs showing your current zoom level. When you double click on a block in the viewer, you'll zoom into that block and your zoom level will be reflected in the breadcrumbs above. The navigation arrows on the top-left let you navigate between previous zoom levels.

Thread filter

In the top-right of the viewer is the thread filter button which allows you to filter the view to a particular thread. Only methods and fields that have been accessed by the selected thread will show up.

Searching

The search box in the top-right corner lets you search for elements in the current view. The search is done as you type into the box and results will blink red. In the search button drop-down, there's an option to Highlight Subs. This option will blink sub-nodes of found results which is useful in a graph view where you want all the nodes of a particular namespace to be highlighted.

View

The main view is rendered according to the options set in the Display tab. The view can be panned by holding down the mouse and dragging. It can also be zoomed by using the mouse wheel. Zooming out the furthest extent will reset the view. Clicking on a node will 'select' it and its edges will become bold. Information about the selected node can be viewed in the Details tab.

Outline Colors

  • Black - Files and unknown types
  • Blue - Namespaces
  • Green - Classes
  • Red - Methods
  • Yellow - Fields

Block Colors

  • Solid Green - A thread entry point.
  • Solid Yellow - Execution is holding inside, for example an event loop.
  • Orange - A method was hit.
  • Green - A field was accessed.
  • Blue - A field was set.
  • Red - An exception was thrown.
  • Gray - A node outside the current zoom level.

Line Colors

  • Dashed Green - A call was made from a function to another function or field.
  • Solid Red - In a graph view this indicates a call made left-to-right.
  • Solid Blue - In a graph view this indicates a call made right-to-left.
  • Half red, half blue - A call in the treemap view. The red half is connected to the source function. The blue half is connected to the destination.
  • Solid Green - Indicates a call has not yet returned. Often seen between thread entry points and their holding function.

Dependency Colors

These colors show up when a dependency based layout is selected.

  • Red - Dependent on selected class.
  • Purple - Inter-dependent on selected class.
  • Blue - Independent of selected class.

Display Tab

Layouts

The layout is how the selected node set is viewed on the screen. The selected node set can vary by zoom level, thread filter, and different include options in the Display tab.

  • Tree Map - This view packs all blocks proportionally on the screen according to what's set in the 'Size by' section. Using this view it's easy to see which blocks have the most code, or take the most time to execute.

  • Layer Graph - In this graph each zoom level is graphed with all other nodes on the same level. If there are a lot of elements on the screen, this graph is a good one to use to keep it all organized. When using the layer graph to zoom in really far it's advised to use the OpenGL renderer because it's a lot faster at high zoom levels.

  • Threadlines - In this view each thread is a vertical grouping of joined columns. Each column is the stack of the thread starting from left to right. Columns are added as methods and fields are called. Columns are removed as methods return. New actions are added to the bottom of the view, and over time move upwards forming the call stack history for a particular thread. In this view the mouse wheel moves the timeline up and down.

  • Initialization - This graph shows the classes each class was initialized by. This is a great view for showing overall program architecture as 'the state' of our program is contained in these classes. We often architect applications by determining the structure in which state will be kept and that structure is often represented as the initialization graph as opposed to the other graphs which represent the execution architecture. Lines between classes in this view are initialization lines, not call lines.

  • Class Graph - This view graphs calls between classes. Methods and field sub-graphs are contained inside each class, and can be turned off in the 'Include' section for an even simpler layout.

  • Method Graph - This view graphs calls between methods and fields with no other organization. This graph is best when viewing a sub-set of the application, for instance a particular thread, or inside a specific class.

  • Depends Map - This is a tree map view that shows nodes to the class level. Blocks are colored based on their dependency to the currently selected class. See the dependency color guide above for what each color means.

  • Depends Graph - This view graphs classes based on what is dependent on what. The left side of the graph is generally more dependent while the further a class is to the right, the more independent it is. The sub-depends checkbox will color all sub-dependencies of a selected node if checked, and only one level of dependency if unchecked.

  • Inter-depends - This view is for finding out how two more classes are dependent on each other. In a different view Control-Click the classes you want examine, and then select the Inter-depends view to see the dependency chain between the selected classes.

Rendering

The renderer determines how the node set is drawn on the screen after the filter and layout process.

  • GDI - This option uses the Windows GDI 2D software renderer. It is slow and cpu intensive, but also starts up fast and looks good.

  • OpenGL - This option uses OpenGL to render the 2D view through hardware. It is less cpu intensive and faster, but takes a bit to startup. It is also more prone to visual artifacts.

  • Gibson - This is an OpenGL 3D renderer. Press 'm' with your cursor over the main UI to go into FPS mode where you can use WSAD to move around. Ctrl and Space to move up and down. And Shift to move faster. The Pause/Resume button below can be used to pause rendering of the 3d scene to improve the FPS rate, don't forget to resume rendering when you're done.

Elements

  • All - This option shows all elements with none of the filters below applied.

  • Executed - Only methods and fields that have been hit are shown. This is a good option to use for cutting down a large tree map and only showing what has been executed so far.

  • Not Execd - Only methods and fields that haven't been hit are shown. This is a good option to use for doing an interactive code coverage test by seeing what functions are left to exercise.

  • Initd - Only classes that have been initialized are shown. This is a good option for viewing the current state of your application as only classes with state information are shown.

  • Reset Hit - This resets all methods and fields to a not-hit state. This is good for analyzing current execution paths. For instance, setting the 'Executed' option, and then clicking 'Reset Hit' should make almost everything disappear, giving you a fresh start in analyzing just the functions that are currently being hit.

Show

  • Calls - This option will show calls made between methods and fields as lines on the view. In the Tree Map view the lines will be half red, half blue, indicating red for source of the call and blue for destination.

  • Real-time - This option shows real-time calls in the view as dashed lines moving in the direction of the call.

  • In Order - In graph mode, the 'In Order' option will organize methods in each column in the order in which they were called by the calling function.

  • Code - This option will show code and field values inside nodes of the view. Zooming in will fit more code in the block while panning the view with the mouse lets you scroll through the code. A code view is also available in the details view for selected method nodes.

Include

  • Outside Zoom - Your current zoom level is determined by the breadcrumbs at the top of the viewer. When you're zoomed in on something you won't see nodes outside that zoom level unless this option is turned on. This option is useful for graphs when you're zoomed in on an area and want to see the outside nodes that are calling into your zoomed area. In graph views nodes that are 'outside' are colored gray inside.

  • Not XRayed - Code Perspective tracks calls made to assemblies that weren't XRayed. To see these calls turn on this option. In graph views, nodes that are Not XRayed show up as triangles.

  • Methods - Shows method nodes when checked, hides them when not checked. Go for viewing application state information only. Or keeping track of where state is changing in the Tree Map view without worrying about what functions are being called.

  • Fields - Show fields when checked, hides when not checked. If you're not interested in what fields are accessed, then turning off the fields view will simplify view graphs.

  • Anon - When this option is on compiler generated anonymous classes, methods and fields are shown in the views. It adds complexity to the views, but gives a more complete picture of what's going on.

Size by

  • Constant - Sizes all methods and fields equally. Good for seeing everything no matter how small.

  • Lines - Sizes methods by how much code is in each.

  • Calls - Sizes methods and fields by how often they are called.

  • Time per Call - Sizes methods by how much time each call takes.

  • Time in Method - Sizes methods by the total time spent in each.

Details Tab

The content of the details tab varies on the type of node that is selected. For files and namespaces, the details tab will show the sub namespaces and classes of what is selected with basic profiling summations. The navigation arrows in the upper-left corner of the tab let you go back and forward between details you've already seen. The up arrow will show details of the container of what's selected.

Classes and Fields

When a class is selected the details tab will show an instance matrix. That is all instances of the class that are currently active will be shown in each column, with the field values of the class as the rows. The grid updates in real-time, but can be paused with the pause button icon in the upper-right corner of the tab. When a field value is detected to have changed its cell in the grid flashes red. The methods radio button in the upper-right shows the methods that are a part of the selected class. If you double-click on a method, the details display will navigate to that method.

The fields view is similar to the class view but only shows the selected field for all class instances.

Methods

  • C# - If 'Decompile to C#' was selected in XBuilder when the assembly was recompiled then this view should show a selected method's decompiled C# code. Only functions that were XRayed have code available, for functions not XRayed you'll see a message, 'Function not XRayed.'

  • MSIL - This option shows the Microsoft Intermediate Language for the selected function. Similar to the C# view, methods and fields called by the function are shown as blue hyperlinks.

  • Profile - The profile view is split into two parts. The left pane shows functions that called the selected function, and the right pane shows functions called by the selected function. The columns of each pane show the amount of time spent in the given function, and the amount of time spent outside given function in sub-calls. In the bottom-right corner is an option to show the average amount of time spent in each method call, or show the cumulative amount of time spent in each method.

Console Tab

The console is a debugging tool for investigating the current state of Code Perspective.

  • calls - Outputs the current list of recorded calls. SourceID -> DestinationID

  • datpath - Shows the path to the XRay.dat file used.

  • eval - Evaluates a dynamic expression written against the Nodes or Main object. See the source code for what properties and methods are available on these objects.

  • findid - Finds the ID of any nodes matching the parameter.

  • id <#> - Shows the name of a node for a given ID.

  • inits - Shows the list of class to class initializations used for the init graph.

  • log - Writes out the current debug and error logs.

  • settings - Shows the settings the application was recompiled with.

  • stacks - Outputs the currently tracked threads with their stacks.

About Tab

The about tab is the same as the one found in XBuilder.exe. Here you'll find version, license, and update information. If the target app was recompiled with Code Perspective Pro then you'll see the license set to Pro with details. Otherwise the license is set to AGPL indicating the current recompiled application should be open source.


Clone this wiki locally