| 44 | return "m%d#%s" % (modules[parts[0]], parts[1]) |
| 45 | |
| 46 | class Function: |
| 47 | def __init__(self, index): |
| 48 | self.index = index |
| 49 | self.has_lo = False |
| 50 | self.has_tf = False |
| 51 | self.time_lo = -1 |
| 52 | self.time_tf = -1 |
| 53 | self.mem_lo = -1 |
| 54 | self.mem_tf_max = -1 |
| 55 | self.mem_tf_total = -1 |
| 56 | self.name = "" |
| 57 | self.size_wasm = -1 |
| 58 | self.size_lo = -1 |
| 59 | self.size_tf = -1 |
| 60 | |
| 61 | def AddLine(self, words): |
| 62 | assert self.index == words[2], "wrong function" |
| 63 | if words[4] == "TurboFan,": |
| 64 | self.AddTFLine(words) |
| 65 | elif words[4] == "Liftoff,": |
| 66 | self.AddLiftoffLine(words) |
| 67 | else: |
| 68 | raise Exception("unknown compiler: %s" % words[4]) |
| 69 | |
| 70 | def AddTFLine(self, words): |
| 71 | assert not self.has_tf, "duplicate TF line for %s" % self.index |
| 72 | self.has_tf = True |
| 73 | # 0 1 2 3 4 5 6 7 8 9 10 11 |
| 74 | # Compiled function #6 using TurboFan, took 0 ms and 14440 / 44656 |
| 75 | # 12 13 14 15 16 17 18 19 |
| 76 | # max/total bytes; bodysize 12 codesize 24 name wasm-function#6 |
| 77 | time_factor = 1 |
| 78 | if words[7] == "ms": |
| 79 | time_factor = 1000 |
| 80 | elif words[7] == "μs": |
| 81 | pass # Default. |
| 82 | else: |
| 83 | assert False, "Time must be in 'ms' or 'μs'." |
| 84 | self.time_tf = int(words[6]) * time_factor |
| 85 | self.mem_tf_max = int(words[9]) |
| 86 | self.mem_tf_total = int(words[11]) |
| 87 | self.size_tf = int(words[17]) |
| 88 | self.name = words[19] |
| 89 | |
| 90 | def AddLiftoffLine(self, words): |
| 91 | assert self.index == words[2], "wrong function" |
| 92 | assert not self.has_lo, "duplicate Liftoff line for %s" % self.index |
| 93 | self.has_lo = True |
| 94 | # 0 1 2 3 4 5 6 7 8 9 10 11 12 |
| 95 | # Compiled function #6 using Liftoff, took 0 ms and 968 bytes; bodysize 4 |
| 96 | # 13 14 |
| 97 | # codesize 68 |
| 98 | time_factor = 1 |
| 99 | if words[7] == "ms": |
| 100 | time_factor = 1000 |
| 101 | elif words[7] == "μs": |
| 102 | pass # Default. |
| 103 | else: |
no outgoing calls
no test coverage detected