Update contrib.
1 # Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
3 # This component and the accompanying materials are made available
4 # under the terms of "Eclipse Public License v1.0"
5 # which accompanies this distribution, and is available
6 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 # Initial Contributors:
9 # Nokia Corporation - initial contribution.
14 # Utility function to append thread names where the Thread Id maps to a known thread/process name.
18 # Takes as input list <data> which contains OST traces from the SYMBIAN_KERNEL_THREAD_IDENTIFICATION trace group in Symbian
19 # BTrace Hooks OST dictionary. Returns a list with the same content as <data> with thread names appended.
27 pattern = "^.*Thread:Process name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$"
28 matched = re.search(pattern, line)
30 processNames[matched.group(2)] = matched.group(3)
32 pattern = "^.*Thread:Thread created;NThread:(.*);DProcess:(.*);Name:(.*)$"
33 matched = re.search(pattern, line)
35 threadNames[matched.group(1)] = processNames[matched.group(2)]+":"+matched.group(3)
37 pattern = "^.*Thread:Thread name assigned;NThread:(.*);DProcess:(.*);Name:(.*)$"
38 matched = re.search(pattern, line)
40 threadNames[matched.group(1)] = processNames[matched.group(2)]+":"+matched.group(3)
42 pattern = "^.*Thread:Thread ID assigned;NThread:(.*);DProcess:(.*);RThread ID:(\d*)$"
43 matched = re.search(pattern, line)
45 rthreadIds[matched.group(3)] = matched.group(1)
47 pattern = "(^.*Thread ID:)(\w*)(.*)$"
48 matched = re.search(pattern, line)
50 threadId = matched.group(2)
51 if threadNames.has_key(threadId):
52 line = matched.group(1)+threadId+":"+threadNames[threadId]+matched.group(3)
54 pattern = "(^.*clientThreadId )(\w*)(.*)$"
55 matched = re.search(pattern, line)
57 rthreadIdHex = matched.group(2)
58 rthreadId = hex(rthreadIdHex)
59 if rthreadIds.has_key(rthreadId):
60 threadId = rthreadIds[rthreadId]
61 threadName = threadNames[threadId]
62 line = matched.group(1)+rthreadId+":"+threadName+matched.group(3)
64 pattern = "(^.*threadId )(\w*)(.*)$"
65 matched = re.search(pattern, line)
67 rthreadIdHex = matched.group(2)
68 rthreadId = hex(rthreadIdHex)
69 if rthreadIds.has_key(rthreadId):
70 threadId = rthreadIds[rthreadId]
71 threadName = threadNames[threadId]
72 line = matched.group(1)+rthreadId+":"+threadName+matched.group(3)