[go: up one dir, main page]

File: t118_thread_tsd.py

package info (click to toggle)
uftrace 0.18.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 5,356 kB
  • sloc: ansic: 49,770; python: 11,181; asm: 837; makefile: 769; sh: 637; cpp: 627; javascript: 191
file content (31 lines) | stat: -rw-r--r-- 1,072 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/env python3

from runtest import TestBase

class TestCase(TestBase):
    def __init__(self):
        TestBase.__init__(self, 'thread-tsd', ldflags='-pthread', result="""
# DURATION    TID     FUNCTION
   1.368 us [ 3336] | __monstartup();
   1.142 us [ 3336] | __cxa_atexit();
            [ 3336] | main() {
   1.019 us [ 3336] |   pthread_key_create();
   1.278 us [ 3336] |   malloc();
   0.828 us [ 3336] |   pthread_setspecific();
  39.549 us [ 3336] |   pthread_create();
            [ 3336] |   pthread_join() {
            [ 3346] | thread() {
   0.804 us [ 3346] |   malloc();
   0.128 us [ 3346] |   pthread_setspecific();
   2.708 us [ 3346] | } /* thread */
 149.452 us [ 3336] |   } /* pthread_join */
   1.684 us [ 3336] |   pthread_getspecific();
   0.549 us [ 3336] |   tsd_dtor();
   0.861 us [ 3336] |   pthread_key_delete();
 199.848 us [ 3336] | } /* main */
""")

    def fixup(self, cflags, result):
        return result.replace('tsd_dtor();', """tsd_dtor() {
   0.347 us [ 3336] |     free();
   0.549 us [ 3336] |   } /* tsd_dtor */""")