|
6 | 6 | # |
7 | 7 | # Copyright (c) 2016-2020 Kestrel Technology LLC |
8 | 8 | # Copyright (c) 2020 Henny Sipma |
9 | | -# Copyright (c) 2021 Aarno Labs LLC |
| 9 | +# Copyright (c) 2021-2025 Aarno Labs LLC |
10 | 10 | # |
11 | 11 | # Permission is hereby granted, free of charge, to any person obtaining a copy |
12 | 12 | # of this software and associated documentation files (the "Software"), to deal |
|
28 | 28 | # ------------------------------------------------------------------------------ |
29 | 29 | import xml.etree.ElementTree as ET |
30 | 30 |
|
31 | | -from typing import Dict, Optional, TYPE_CHECKING |
| 31 | +from typing import Dict, List, Optional, TYPE_CHECKING |
32 | 32 |
|
33 | 33 | import chb.util.fileutil as UF |
34 | 34 |
|
@@ -236,22 +236,27 @@ def as_dictionary(self) -> Dict[str, str]: |
236 | 236 | def metrics_to_string( |
237 | 237 | self, |
238 | 238 | shownocallees: bool = False, |
239 | | - space: str = " ") -> str: |
| 239 | + space: str = " ", |
| 240 | + annotations: List[str] = []) -> str: |
240 | 241 | callcount = '' |
241 | 242 | name = '' |
242 | 243 | unrc = '' |
| 244 | + anns = "" |
243 | 245 | if shownocallees and (not self.has_name()): |
244 | 246 | if self.call_count == 0: |
245 | 247 | callcount = ' (no callees)' |
246 | 248 | if self.has_name(): |
247 | 249 | name = ' (' + self.name + ')' |
248 | 250 | if self.unresolved_call_count > 0: |
249 | 251 | unrc = str(self.unresolved_call_count) |
| 252 | + if len(annotations) > 0: |
| 253 | + anns = " [" + ", ".join(annotations) + "]" |
| 254 | + |
250 | 255 | return (str(self.faddr).ljust(10) + space |
251 | 256 | + '{:6.1f}'.format(self.espp) + space |
252 | 257 | + '{:6.1f}'.format(self.readsp) + space |
253 | 258 | + '{:6.1f}'.format(self.writesp) + space |
254 | 259 | + unrc.rjust(6) + space |
255 | 260 | + str(self.block_count).rjust(6) + space |
256 | 261 | + str(self.instruction_count).rjust(6) + space |
257 | | - + '{:8.3f}'.format(self.time) + name + callcount) |
| 262 | + + '{:8.3f}'.format(self.time) + name + callcount + anns) |
0 commit comments