File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change @@ -27,7 +27,7 @@ import (
2727)
2828
2929func main () {
30- fmt .Println ("=== StreamSQL 持久化功能测试 ===\n " )
30+ fmt .Println ("=== StreamSQL 持久化功能测试 ===" )
3131
3232 // 清理之前的测试数据
3333 cleanupTestData ()
@@ -37,14 +37,14 @@ func main() {
3737 testDataOverflowPersistence ()
3838
3939 // 测试2: 模拟程序重启和数据恢复
40- fmt .Println ("\n 📌 测试2: 程序重启数据恢复" )
40+ fmt .Println ("📌 测试2: 程序重启数据恢复" )
4141 testDataRecovery ()
4242
4343 // 测试3: 查看持久化文件内容
44- fmt .Println ("\n 📌 测试3: 持久化文件分析" )
44+ fmt .Println ("📌 测试3: 持久化文件分析" )
4545 analyzePersistenceFiles ()
4646
47- fmt .Println ("\n ✅ 真正持久化功能测试完成!" )
47+ fmt .Println ("✅ 真正持久化功能测试完成!" )
4848}
4949
5050func testDataOverflowPersistence () {
Original file line number Diff line number Diff line change @@ -117,9 +117,9 @@ func TestGetAllAvailableFunctions(t *testing.T) {
117117 // 验证函数数量合理
118118 streamSQLFuncs := info ["streamsql" ].(map [string ]interface {})
119119 t .Logf ("StreamSQL functions count: %d" , len (streamSQLFuncs ))
120- for name := range streamSQLFuncs {
121- t .Logf ("StreamSQL function: %s" , name )
122- }
120+ // for name := range streamSQLFuncs {
121+ // t.Logf("StreamSQL function: %s", name)
122+ // }
123123 assert .GreaterOrEqual (t , len (streamSQLFuncs ), 1 ) // 至少应该有一个函数
124124
125125 exprLangFuncs := info ["expr-lang" ].(map [string ]interface {})
Original file line number Diff line number Diff line change @@ -264,13 +264,15 @@ func BenchmarkPureInputPerformance(b *testing.B) {
264264 }
265265
266266 b .ResetTimer ()
267+ start := time .Now ()
267268
268269 // 测量纯输入吞吐量
269270 for i := 0 ; i < b .N ; i ++ {
270271 ssql .AddData (data )
271272 }
272273
273- duration := b .Elapsed ()
274+ b .StopTimer ()
275+ duration := time .Since (start )
274276 throughput := float64 (b .N ) / duration .Seconds ()
275277 b .ReportMetric (throughput , "pure_input_ops/sec" )
276278}
@@ -1391,15 +1393,15 @@ func BenchmarkOptimizedPerformance(b *testing.B) {
13911393 }
13921394
13931395 b .ResetTimer ()
1396+ start := time .Now ()
13941397
13951398 for i := 0 ; i < b .N ; i ++ {
13961399 ssql .AddData (data )
13971400 }
13981401
1399- duration := b .Elapsed ()
1400- throughput := float64 (b .N ) / duration .Seconds ()
1401-
14021402 b .StopTimer ()
1403+ duration := time .Since (start )
1404+ throughput := float64 (b .N ) / duration .Seconds ()
14031405
14041406 // 获取统计
14051407 detailedStats := ssql .Stream ().GetDetailedStats ()
@@ -2460,16 +2462,16 @@ func BenchmarkPurePerformance(b *testing.B) {
24602462 }
24612463
24622464 b .ResetTimer ()
2465+ start := time .Now ()
24632466
24642467 // 纯输入性能测试
24652468 for i := 0 ; i < b .N ; i ++ {
24662469 ssql .AddData (data )
24672470 }
24682471
2469- duration := b .Elapsed ()
2470- throughput := float64 (b .N ) / duration .Seconds ()
2471-
24722472 b .StopTimer ()
2473+ duration := time .Since (start )
2474+ throughput := float64 (b .N ) / duration .Seconds ()
24732475 cancel ()
24742476
24752477 b .ReportMetric (throughput , "pure_ops/sec" )
You can’t perform that action at this time.
0 commit comments