mirror of
https://github.com/mandiant/capa.git
synced 2025-12-22 07:10:29 -08:00
profile-time: more result reporting, and learn to specify other backends
This commit is contained in:
committed by
Willi Ballenthin
parent
ee98548bf9
commit
519cfb842e
@@ -10,7 +10,7 @@ Invoke capa multiple times and record profiling informations.
|
|||||||
Use the --number and --repeat options to change the number of iterations.
|
Use the --number and --repeat options to change the number of iterations.
|
||||||
By default, the script will emit a markdown table with a label pulled from git.
|
By default, the script will emit a markdown table with a label pulled from git.
|
||||||
|
|
||||||
Note: you can run this script against pre-generated .frz files to reduce the startup time.
|
This script requires the additional dependency `humanize`.
|
||||||
|
|
||||||
usage:
|
usage:
|
||||||
|
|
||||||
@@ -43,6 +43,7 @@ import argparse
|
|||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
import tqdm
|
import tqdm
|
||||||
|
import humanize
|
||||||
import tabulate
|
import tabulate
|
||||||
|
|
||||||
import capa.main
|
import capa.main
|
||||||
@@ -74,7 +75,7 @@ def main(argv=None):
|
|||||||
label += " (dirty)"
|
label += " (dirty)"
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description="Profile capa performance")
|
parser = argparse.ArgumentParser(description="Profile capa performance")
|
||||||
capa.main.install_common_args(parser, wanted={"format", "os", "input_file", "signatures", "rules"})
|
capa.main.install_common_args(parser, wanted={"format", "backend", "os", "input_file", "signatures", "rules"})
|
||||||
parser.add_argument("--number", type=int, default=3, help="batch size of profile collection")
|
parser.add_argument("--number", type=int, default=3, help="batch size of profile collection")
|
||||||
parser.add_argument("--repeat", type=int, default=30, help="batch count of profile collection")
|
parser.add_argument("--repeat", type=int, default=30, help="batch count of profile collection")
|
||||||
parser.add_argument("--label", type=str, default=label, help="description of the profile collection")
|
parser.add_argument("--label", type=str, default=label, help="description of the profile collection")
|
||||||
@@ -107,6 +108,18 @@ def main(argv=None):
|
|||||||
for counter, count in capa.perf.counters.most_common():
|
for counter, count in capa.perf.counters.most_common():
|
||||||
logger.debug("perf: counter: %s: %s", counter, count)
|
logger.debug("perf: counter: %s: %s", counter, count)
|
||||||
|
|
||||||
|
print(
|
||||||
|
tabulate.tabulate(
|
||||||
|
[
|
||||||
|
(counter, humanize.intcomma(count))
|
||||||
|
for counter, count in capa.perf.counters.most_common()
|
||||||
|
],
|
||||||
|
headers=["feature class", "evaluation count"],
|
||||||
|
tablefmt="github",
|
||||||
|
)
|
||||||
|
)
|
||||||
|
print()
|
||||||
|
|
||||||
print(
|
print(
|
||||||
tabulate.tabulate(
|
tabulate.tabulate(
|
||||||
[
|
[
|
||||||
|
|||||||
Reference in New Issue
Block a user