better benchmarks

This commit is contained in:
Radu Ioan Fericean
2012-02-13 23:00:03 +02:00
parent c2497219ef
commit 2a29752bf5
2 changed files with 29 additions and 1 deletions

View File

@@ -57,7 +57,7 @@ func TestApStoreRestore(t *testing.T) {
}
}
func BenchmarkRestore(b *testing.B) {
func BenchmarkActivationPeriodRestore(b *testing.B) {
ap1 := ActivationPeriod{}
for i := 0; i < b.N; i++ {
ap1.restore("1328106601;2|1|3,4|14:30:00|15:00:00|0|0|0|0;")

View File

@@ -155,6 +155,20 @@ func BenchmarkRedisGetting(b *testing.B) {
}
}
func BenchmarkRedisRestoring(b *testing.B) {
b.StopTimer()
getter, _ := NewRedisStorage("", 10)
defer getter.Close()
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2}
b.StartTimer()
for i := 0; i < b.N; i++ {
cd.RestoreFromStorage(getter)
}
}
func BenchmarkRedisGetCost(b *testing.B) {
b.StopTimer()
getter, _ := NewRedisStorage("", 10)
@@ -184,6 +198,20 @@ func BenchmarkKyotoGetting(b *testing.B) {
}
}
func BenchmarkKyotoRestoring(b *testing.B) {
b.StopTimer()
getter, _ := NewKyotoStorage("test.kch")
defer getter.Close()
t1 := time.Date(2012, time.February, 2, 17, 30, 0, 0, time.UTC)
t2 := time.Date(2012, time.February, 2, 18, 30, 0, 0, time.UTC)
cd := &CallDescriptor{CstmId: "vdf", Subject: "rif", DestinationPrefix: "0256", TimeStart: t1, TimeEnd: t2}
b.StartTimer()
for i := 0; i < b.N; i++ {
cd.RestoreFromStorage(getter)
}
}
func BenchmarkSplitting(b *testing.B) {
b.StopTimer()
getter, _ := NewKyotoStorage("test.kch")