Changeset 291:be800419204e in finroc_tools_finstruct-java


Ignore:
Timestamp:
13.12.2020 21:05:49 (3 years ago)
Author:
Max Reichardt <mreichardt@…>
Branch:
default
Phase:
public
Message:

Adapts task profile viewer to also display profiles that do not reference framework elements (e.g. code profiles from development_utils plugin)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • propertyeditor/TaskProfileViewer.java

    r274 r291  
    123123            return; 
    124124        } 
     125 
     126        // If handles are invalid (possibly a code section profile), display indices instead of framework element names 
     127        boolean displayIndices = false; 
     128        if (t.size() > 1) { 
     129            displayIndices = true; 
     130            for (int i = 1; i < Math.min(5, t.size()); i++) { 
     131                displayIndices &= t.get(i).handle == 0; 
     132            } 
     133        } 
     134 
    125135        Object[][] data = new Object[t.size()][]; 
    126136        for (int i = 0; i < t.size(); i++) { 
     
    131141            data[i][0] = name; 
    132142            if (i > 0) { 
    133                 RemoteFrameworkElement element = runtime.getRemoteElement(taskProfile.handle); 
    134                 if (element.isInterface()) { 
    135                     element = (RemoteFrameworkElement)element.getParent(); 
     143                if (displayIndices) { 
     144                    name.string = i + " (~" + Math.round(taskProfile.totalExecutionDuration.getNumericRepresentation().doubleValue() / taskProfile.averageExecutionDuration.getNumericRepresentation().doubleValue()) + " executions)"; 
     145                } else { 
     146                    RemoteFrameworkElement element = runtime.getRemoteElement(taskProfile.handle); 
     147                    if (element.isInterface()) { 
     148                        element = (RemoteFrameworkElement)element.getParent(); 
     149                    } 
     150                    name.string = element == null ? "Unknown" : element.getQualifiedLink(); 
    136151                } 
    137                 name.string = element == null ? "Unknown" : element.getQualifiedLink(); 
    138152            } 
    139153            data[i][1] = new ColoredString(taskProfile.lastExecutionDuration.toString(), color); 
Note: See TracChangeset for help on using the changeset viewer.