abi detection through multi threads

This commit is contained in:
xuezhixin 2024-11-11 14:28:04 +08:00
parent 8de8f0fdbb
commit f84f8ce10f
2 changed files with 75 additions and 2 deletions

View File

@ -0,0 +1,70 @@
From ef8d18b5e61506b7450f1fb96ca895e704f9de7a Mon Sep 17 00:00:00 2001
From: xuezhixin <xuezhixin@uniontech.com>
Date: Mon, 13 Nov 2023 15:23:16 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E7=BA=BF=E7=A8=8B=E5=AE=8C=E6=88=90AB?=
=?UTF-8?q?I=E6=A3=80=E6=9F=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
sysmig_agent/Abisystmcompchk.py | 46 +++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/sysmig_agent/Abisystmcompchk.py b/sysmig_agent/Abisystmcompchk.py
index 493c09b..79e6581 100644
--- a/sysmig_agent/Abisystmcompchk.py
+++ b/sysmig_agent/Abisystmcompchk.py
@@ -919,3 +919,49 @@ def migrate_behind_abi_chk():
i = i + 1
return '0'
+
+
+def MutilThread(nameList, Query, muth_logger):
+ global exitFlag
+
+ # Default number of cpus
+ thread_num = int(cpu_count() * 1.5)
+
+ threadList = ["Thread-%d" % (num) for num in range(0, thread_num)]
+
+ threads = []
+ threadID = 10
+ # threadID = 1
+
+ fw = open(abi_incomp_chk, 'w')
+ fr = open(abi_comp_chk, 'w')
+
+ # Creating new thread
+ for tName in threadList:
+ thread = myThread(threadID, tName, workQueue, queueLock, fw, fr, Query, muth_logger)
+ thread.start()
+ threads.append(thread)
+ threadID += 1
+
+ # Fill in the queue
+ queueLock.acquire()
+ for word in nameList:
+ workQueue.put(word)
+ queueLock.release()
+
+ # Waiting queue clear
+ while not workQueue.empty():
+ pass
+
+ # Notifies the thread that it is time to exit
+ exitFlag = 1
+
+ # Wait for all threads to complete
+ for t in threads:
+ t.join()
+ muth_logger.info('========== Exit main thread...... ==========')
+
+ fw.close()
+ fr.close()
+
+ return True
--
2.20.1

View File

@ -1,6 +1,6 @@
Name: migration-tools
Version: 1.0.3
Release: 4
Release: 5
License: MulanPSL-2.0
Summary: A tool to help users migrate the Centos system to the UOS system and openEuler system
Source0: %{name}-%{version}.tar.gz
@ -11,7 +11,7 @@ Patch001: 0001-download-the-rpm-package-in-the-system.patch
Patch002: 0002-get-information-before-migration.patch
Patch003: 0003-export-migration-check-report.patch
Patch004: 0004-complete-information-report-after-abi-detection.patch
Patch005: 0005-abi-detection-through-multi-threads.patch
@ -114,6 +114,9 @@ rm -rf /usr/bin/migration-tools
%endif
%changelog
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-5
- 0005-abi-detection-through-multi-threads.patch
* Mon Nov 11 2024 xuezhixin <xuezhixin@uniontech.com> - 1.0.3-4
- 0004-complete-information-report-after-abi-detection.patch