测试通过

This commit is contained in:
Cheney Wong 2025-07-02 16:29:15 +08:00
parent fc1c22b8a3
commit 7d12a1af80

View File

@ -338,7 +338,7 @@ public class TestAll {
System.out.println("TPS: " + String.format("%.2f", tps));
System.out.println("吞吐量: " + String.format("%.2f", throughput) + " MB/S");
double avgLatency = duration * 1.0 / totalRequest;
writeToPerformanceFile("SM4-MAC短数据", 1024, 1, numberOfThreads, totalRequest, tps, avgLatency);
writeToPerformanceFile("SM4MAC 短数据", 1024, 1, numberOfThreads, totalRequest, tps, avgLatency);
}
public void sm4macBatchEndes() throws InterruptedException {
@ -390,7 +390,7 @@ public class TestAll {
System.out.println("TPS: " + String.format("%.2f", tps));
System.out.println("吞吐量: " + String.format("%.2f", throughput) + " MB/S");
double avgLatency = duration * 1.0 / totalRequest;
writeToPerformanceFile("SM4-MAC批量数据", 1024, 1, numberOfThreads, totalRequest, String.format("%.2f", tps) + " x 4", avgLatency);
writeToPerformanceFile("SM4MAC 批量数据", 1024, 1, numberOfThreads, totalRequest, String.format("%.2f", tps) + " x 4", avgLatency);
}
public void sm3ShortEndes() throws InterruptedException {
@ -441,13 +441,13 @@ public class TestAll {
}
public void sm4ShortMacEndes() throws InterruptedException {
System.out.println("-------- SM4短数据加密生成MAC,解密验证MAC性能测试开始 --------");
System.out.println("-------- SM4短数据加密生成MAC,验证MAC解密性能测试开始 --------");
System.out.println("单线程");
sm4ShortMacEnde(1, config.getTotal(), 1024);
System.out.println("40 线程");
sm4ShortMacEnde(40, config.getTotal(), 1024);
System.out.println("-------- SM4短数据加密生成MAC,解密验证MAC性能测试结束 --------\n");
System.out.println("-------- SM4短数据加密生成MAC,验证MAC解密性能测试结束 --------\n");
}
public void sm4ShortMacEnde(int numberOfThreads, int totalRequest, int plainLen) throws InterruptedException {
@ -523,12 +523,12 @@ public class TestAll {
}
public void sm4BatchMacEndes() throws InterruptedException {
System.out.println("-------- SM4批量数据加密生成MAC,解密验证MAC性能测试开始 --------");
System.out.println("-------- SM4批量数据加密生成MAC,验证MAC解密性能测试开始 --------");
System.out.println("单线程");
sm4BatchMacEnde(1, config.getTotal(), 1024);
System.out.println("40 线程");
sm4BatchMacEnde(40, config.getTotal(), 1024);
System.out.println("-------- SM4批量数据加密生成MAC,解密验证MAC性能测试结束 --------\n");
System.out.println("-------- SM4批量数据加密生成MAC,验证MAC解密性能测试结束 --------\n");
}
public void sm4BatchMacEnde(int numberOfThreads, int totalRequest, int plainLen) throws InterruptedException {
@ -610,7 +610,7 @@ public class TestAll {
public void sm4LongEnde() {
System.out.println("-------- SM4长数据加解密性能测试开始 --------");
byte[] data = new byte[1024 * 4];
byte[] data = new byte[2048];
int key = 0;
// ByteBuffer enDataBuff = ByteBuffer.allocate(100 * 1024 * 1024 + 16);
@ -642,9 +642,8 @@ public class TestAll {
sm4 = api.initSM4(key, ECB_DEC);
for (int i = 0; i < 100 * 1024 * 1024 / data.length; i++) {
sm4.update(Arrays.copyOfRange(res, i * 1024, (i + 1) * 1024));
sm4.update(data);
}
sm4.update(Arrays.copyOfRange(res, 100 * 1024 * 1024, 100 * 1024 * 1024 + 16));
// sm4.finish();
end = System.currentTimeMillis();
@ -662,7 +661,7 @@ public class TestAll {
public void sm4MacLongEnde() {
System.out.println("-------- SM4MAC长数据性能测试开始 --------");
byte[] data = new byte[1024 * 4];
byte[] data = new byte[2048];
SydApiBuilder builder = new SydApiBuilder(
config.getIps(),
@ -694,7 +693,7 @@ public class TestAll {
public void sm3LongEnde() {
System.out.println("-------- SM3长数据性能测试开始 --------");
byte[] data = new byte[1024 * 4];
byte[] data = new byte[2048];
SydApiBuilder builder = new SydApiBuilder(
config.getIps(),
@ -1276,11 +1275,11 @@ public class TestAll {
System.out.println("5. SM4 短数据加解密");
System.out.println("6. SM4 批量数据加解密");
System.out.println("7. SM4-MAC 短数据");
System.out.println("8. SM4-MAC 批量数据");
System.out.println("7. SM4MAC 短数据");
System.out.println("8. SM4MAC 批量数据");
System.out.println("9. SM4短数据加密后生成MAC解密验证MAC");
System.out.println("10. SM4批量数据加密后生成MAC解密验证MAC");
System.out.println("10. SM4批量数据加密后生成MAC验证MAC解密");
System.out.println("11. SM4长数据加解密");
@ -1364,8 +1363,8 @@ public class TestAll {
System.out.println("请选择测试项:");
System.out.println("1.SM4 短数据加解密");
System.out.println("2.SM4 批量数据加解密");
System.out.println("3.SM4-MAC短数据");
System.out.println("4.SM4-MAC批量数据");
System.out.println("3.SM4MAC 短数据");
System.out.println("4.SM4MAC 批量数据");
System.out.println("5.SM3 短数据");
System.out.println("6.SM4 短数据加密后生成MAC解密验证MAC");
System.out.println("7.SM4 批量数据加密后生成MAC解密验证MAC");