|
@@ -237,7 +237,7 @@ if __name__ == '__main__':
|
|
cursor.execute("show tables like '%%%s%%' " % fre)
|
|
cursor.execute("show tables like '%%%s%%' " % fre)
|
|
table_list = [tuple[0] for tuple in cursor.fetchall()]
|
|
table_list = [tuple[0] for tuple in cursor.fetchall()]
|
|
# print(table_list)
|
|
# print(table_list)
|
|
- # table_list = table_list[0:100]
|
|
|
|
|
|
+ table_list = table_list[0:100]
|
|
|
|
|
|
mgr = Manager()
|
|
mgr = Manager()
|
|
ns = mgr.Namespace()
|
|
ns = mgr.Namespace()
|
|
@@ -247,7 +247,7 @@ if __name__ == '__main__':
|
|
sttime = dt.now()
|
|
sttime = dt.now()
|
|
thread_list = []
|
|
thread_list = []
|
|
for num in range(30, 120, 10):
|
|
for num in range(30, 120, 10):
|
|
- for Volatility in range(3, 21, 1):
|
|
|
|
|
|
+ for Volatility in range(10, 21, 1):
|
|
for rate in range(5, 15, 1):
|
|
for rate in range(5, 15, 1):
|
|
#获得cpu数量,计算进程数
|
|
#获得cpu数量,计算进程数
|
|
# step = math.ceil(len(table_list)/cpu_count/100)*100
|
|
# step = math.ceil(len(table_list)/cpu_count/100)*100
|
|
@@ -262,10 +262,13 @@ if __name__ == '__main__':
|
|
# p.join()
|
|
# p.join()
|
|
print(len(thread_list))
|
|
print(len(thread_list))
|
|
print('开始轮循!')
|
|
print('开始轮循!')
|
|
- for thread in thread_list:
|
|
|
|
- thread.start()
|
|
|
|
- for thread in thread_list:
|
|
|
|
- thread.join()
|
|
|
|
|
|
+ step = int(len(thread_list)/cpu_count)
|
|
|
|
+ thread_list_b = [thread_list[i:i+step] for i in range(0, len(thread_list), step)]
|
|
|
|
+ for t_list in thread_list_b:
|
|
|
|
+ for thread in t_list:
|
|
|
|
+ thread.start()
|
|
|
|
+ for thread in t_list:
|
|
|
|
+ thread.join()
|
|
print('NS.DF:', '\n', ns.df)
|
|
print('NS.DF:', '\n', ns.df)
|
|
edtime = dt.now()
|
|
edtime = dt.now()
|
|
print('总耗时:', edtime - sttime)
|
|
print('总耗时:', edtime - sttime)
|