Skip to content

Commit

Permalink
added pyperf test case
Browse files Browse the repository at this point in the history
  • Loading branch information
JarryShaw committed May 4, 2023
1 parent 7870f49 commit 6311fb0
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/test_perf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-

import pyperf

from pcapkit import extract


def default() -> 'None':
extract(fin='../sample/in.pcap', fout='../sample/engines/default.txt',
format='tree', engine='default')


def scapy() -> 'None':
extract(fin='../sample/in.pcap', fout='../sample/engines/scapy.txt',
format='tree', engine='scapy')


def dpkt() -> 'None':
extract(fin='../sample/in.pcap', fout='../sample/engines/dpkt.txt',
format='tree', engine='dpkt')


def pyshark() -> 'None':
extract(fin='../sample/in.pcap', fout='../sample/engines/pyshark.txt',
format='tree', engine='pyshark')


runner = pyperf.Runner()
runner.bench_func('default', default)
runner.bench_func('scapy', scapy)
runner.bench_func('dpkt', dpkt)
runner.bench_func('pyshark', pyshark)

0 comments on commit 6311fb0

Please sign in to comment.