Skip to content

Commit 6311fb0

Browse files
committed
added pyperf test case
1 parent 7870f49 commit 6311fb0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/test_perf.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import pyperf
4+
5+
from pcapkit import extract
6+
7+
8+
def default() -> 'None':
9+
extract(fin='../sample/in.pcap', fout='../sample/engines/default.txt',
10+
format='tree', engine='default')
11+
12+
13+
def scapy() -> 'None':
14+
extract(fin='../sample/in.pcap', fout='../sample/engines/scapy.txt',
15+
format='tree', engine='scapy')
16+
17+
18+
def dpkt() -> 'None':
19+
extract(fin='../sample/in.pcap', fout='../sample/engines/dpkt.txt',
20+
format='tree', engine='dpkt')
21+
22+
23+
def pyshark() -> 'None':
24+
extract(fin='../sample/in.pcap', fout='../sample/engines/pyshark.txt',
25+
format='tree', engine='pyshark')
26+
27+
28+
runner = pyperf.Runner()
29+
runner.bench_func('default', default)
30+
runner.bench_func('scapy', scapy)
31+
runner.bench_func('dpkt', dpkt)
32+
runner.bench_func('pyshark', pyshark)

0 commit comments

Comments
 (0)