From d6da023297772c9df90c93c50a327786f5ae782d Mon Sep 17 00:00:00 2001
From: Administrator <admin@example.com>
Date: 星期五, 25 八月 2023 16:17:14 +0800
Subject: [PATCH] 交易通道备用

---
 test/test_mmap.py |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/test/test_mmap.py b/test/test_mmap.py
index 2f8d88f..9fd5419 100644
--- a/test/test_mmap.py
+++ b/test/test_mmap.py
@@ -5,21 +5,23 @@
 
 
 def run_process_1(pipe):
-    with contextlib.closing(mmap.mmap(-1, 1000*100, tagname='l2-000333', access=mmap.ACCESS_WRITE)) as m:
+    with contextlib.closing(mmap.mmap(-1, 1000 * 100, tagname='l2-000333', access=mmap.ACCESS_WRITE)) as m:
         for i in range(1, 10001):
+            start = time.time()
             m.seek(0)
-            m.write(("msg " + str(i)).encode("utf-8"))
+            m.write((f"msg {i} " * 10000).encode("utf-8"))
             m.flush()
+            print("鑰楁椂", time.time() - start)
             time.sleep(1)
 
 
 def run_process_2(pipe):
     while True:
-        with contextlib.closing(mmap.mmap(-1, 6, tagname='l2-000333', access=mmap.ACCESS_READ)) as m:
-            s = m.read(1024)
+        with contextlib.closing(mmap.mmap(-1, 1000 * 100, tagname='l2-000333', access=mmap.ACCESS_READ)) as m:
+            s = m.read(1000 * 100)
             s = s.decode('utf-8').replace('\x00', '')
             if s:
-                print(s)
+                print(len(s), s)
             time.sleep(1)
 
 

--
Gitblit v1.8.0