#!/usr/bin/env python # # ftd (function trace dump): # Read data from an ftrace function graph dump, and format various ways. # # Based on kd (kft dump). # # Written by Tim Bird # # Copyright 2009 Sony Corporation of America # # GPL 2.0 applies # # ToDo: # MAJOR_VERSION = 0 MINOR_VERSION = 5 SUBMINOR_VERSION = 0 # define some constants UNKNOWN = "-1" PROGNAME_UNKNOWN = "unknown" PID_UNKNOWN = "-2" import sys, os import time import re debug = 0 class stats_class: def __init__(self): self.missing_callers = 0 self.missing_exits = 0 self.unknown_function_closes = 0 self.total_functions = 0 stats = stats_class() def dprint(msg): global debug if debug: print msg def usage(): print """usage: %s [] This program parses the output from a set of kft message lines Options: -n Only show the most time-consuming functions -t