summaryrefslogtreecommitdiff
path: root/tools/trace/trace.py
blob: e6a2c7561a193f0cbd58373af76c8178793ea3a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/usr/env python

from optparse import OptionParser
import sys
from tcreator.tcreator import *
from tinter.tinter import *

INTER_MODE=" (only available on interpretor  mode)."
CREATE_MODE=" (only available on create mode)."

print "Trace System v1.1 by APBTeam\n"

parser = OptionParser()
parser.add_option("-e", "--enum-name", dest="enum_name",
        help="provide the enumerator name" + CREATE_MODE,
        metavar="ENUM")
parser.add_option("-o", "--output", dest="outfile",
        help="Store the enumerator on the output file" + CREATE_MODE)
parser.add_option("-i", "--infile", dest="infile",
        help="Read the data from the file")
parser.add_option("-t", "--type", dest="type",
        help="create to create the enumeration, inter to read the log from the flash.")
parser.add_option("-l", "--list", dest="list_trace", action="store_true",
        help="List the number of the traces" + INTER_MODE)
parser.add_option("-n", "--num", type="int", dest="trace",
        help="Dump the trace number provided" + INTER_MODE)
parser.add_option("-c", "--callback", dest="cb",
        help="The callback file containing the functions" + INTER_MODE)

[options, args] = parser.parse_args()

if options.type == 'create':
    cre = TCreator (options.infile, options.outfile, options.enum_name)
    cre.create ()
elif options.type == "inter":
    inter = TInter (options.infile, options.outfile, args[0], options.cb)
    if options.list_trace:
        inter.available_traces ()
    elif options.trace != None:
        inter.trace_print (options.trace)
    else:
        inter.trace_print()
else:
    print "see the help\n python trace --help"