1212
1313# pylint: disable=line-too-long
1414
15+ import os
16+ import sys
1517from io import BytesIO
1618from platform import python_version
1719from platform import version as osver
1820from sys import argv
1921from time import process_time_ns
2022
23+ # get path to site-packages (source) folder within venv
24+ pypath = (
25+ f"{ os .path .expanduser ("~" )} /pygpsclient/lib/python"
26+ f"{ sys .version_info .major } .{ sys .version_info .minor } /site-packages"
27+ )
28+ sys .path .insert (0 , os .path .abspath (pypath ))
29+
2130from pyunigps ._version import __version__ as univer
2231from pyunigps .unireader import UNIReader
2332
33+ CYAN = "\033 [1m\033 [36m"
34+ NORM = "\033 [0m"
2435UNIMESSAGES = [
2536 b"\xaa D\xb5 Y%\x00 4\x01 \x00 \xa0 e\t \xe8 [\x80 \x04 \x00 \x00 \x00 \x00 \x00 \x12 \x02 \x00 \x1f \x00 \x00 \x00 14208\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 HRPT00-S10C-P\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 2310415000015-O322A3233801305\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 ff3bbd949ceb95fc\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 2024/05/23\x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 \xb6 \xc0 \x95 \x94 " ,
2637 b"\xaa D\xb5 Y\xfb \x03 \x01 \x00 \x00 \xa0 e\t \xe8 [\x80 \x04 \x00 \x00 \x00 \x00 \x00 \x12 \x03 \x00 \x00 \x94 #\x96 '" ,
@@ -113,11 +124,12 @@ def benchmark(**kwargs) -> float:
113124 txnt = txnc * cyc
114125
115126 print (
116- f"\n Operating system: { osver ()} " ,
117- f"\n Python version: { python_version ()} " ,
118- f"\n pyunigps version: { univer } " ,
119- f"\n Test cycles: { cyc :,} " ,
120- f"\n Txn per cycle: { txnc :,} " ,
127+ f"\n Absolute path: { CYAN } { pypath } { NORM } " ,
128+ f"\n Operating system: { CYAN } { osver ()} { NORM } " ,
129+ f"\n Python version: { CYAN } { python_version ()} { NORM } " ,
130+ f"\n pyunigps version: { CYAN } { univer } { NORM } " ,
131+ f"\n Test cycles: { CYAN } { cyc :,} { NORM } " ,
132+ f"\n Txn per cycle: { CYAN } { txnc :,} { NORM } " ,
121133 )
122134
123135 start = process_time_ns ()
@@ -136,7 +148,8 @@ def benchmark(**kwargs) -> float:
136148 kbs = round (msglen * 1e9 / duration / 2 ** 10 , 2 )
137149
138150 print (
139- f"\n { txnt :,} messages processed in { duration / 1e9 :,.3f} seconds = { txs :,.2f} txns/second, { kbs :,.2f} kB/second.\n "
151+ f"\n { txnt :,} messages processed in { duration / 1e9 :,.3f} seconds = "
152+ f"{ CYAN } { txs :,.2f} { NORM } txns/second, { CYAN } { kbs :,.2f} { NORM } kB/second ({ CYAN } { kbs * 8000 :,.0f} { NORM } baud).\n "
140153 )
141154
142155 return txs , kbs
0 commit comments