本文整理汇总了Golang中launchpad/net/gocheck.C.ResetTimer方法的典型用法代码示例。如果您正苦于以下问题:Golang C.ResetTimer方法的具体用法?Golang C.ResetTimer怎么用?Golang C.ResetTimer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类launchpad/net/gocheck.C
的用法示例。
在下文中一共展示了C.ResetTimer方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: BenchmarkManagedStorageCreate
func (s *benchmarkSuite) BenchmarkManagedStorageCreate(c *gc.C) {
db := s.Session.DB("a-database")
txnRunner := jujuTxn.NewRunner(txn.NewRunner(db.C("txns")))
rstore := storage.NewGridFS(db.Name, "prefix", s.Session)
store := storage.NewManagedStorage(db, txnRunner, rstore)
c.ResetTimer()
const fileSize = 30 * 1024
for i := 0; i < c.N; i++ {
src := newDataSource(int64(i), fileSize)
err := store.PutForEnvironment("env-uuid", fmt.Sprintf("file%d", i), src, fileSize)
c.Assert(err, gc.IsNil)
}
}
示例2: BenchmarkAddAndAssignUnit
func (*BenchmarkSuite) BenchmarkAddAndAssignUnit(c *gc.C) {
var s ConnSuite
s.SetUpSuite(c)
defer s.TearDownSuite(c)
s.SetUpTest(c)
defer s.TearDownTest(c)
charm := s.AddTestingCharm(c, "wordpress")
svc := s.AddTestingService(c, "wordpress", charm)
c.ResetTimer()
for i := 0; i < c.N; i++ {
unit, err := svc.AddUnit()
c.Assert(err, gc.IsNil)
err = s.State.AssignUnit(unit, state.AssignClean)
c.Assert(err, gc.IsNil)
}
}
示例3: BenchmarkSingle
func (self *ProtobufClientSuite) BenchmarkSingle(c *gocheck.C) {
var HEARTBEAT_TYPE = protocol.Request_HEARTBEAT
prs := FakeHeartbeatServer()
client := NewProtobufClient(prs.Listener.Addr().String(), time.Second)
client.Connect()
c.ResetTimer()
for i := 0; i < c.N; i++ {
responseChan := make(chan *protocol.Response, 1)
heartbeatRequest := &protocol.Request{
Type: &HEARTBEAT_TYPE,
Database: protocol.String(""),
}
rcw := cluster.NewResponseChannelWrapper(responseChan)
client.MakeRequest(heartbeatRequest, rcw)
<-responseChan
}
}
示例4: BenchmarkAddUnit
func (*BenchmarkSuite) BenchmarkAddUnit(c *gc.C) {
// TODO(rog) embed ConnSuite in BenchmarkSuite when
// gocheck calls appropriate fixture methods for benchmark
// functions.
var s ConnSuite
s.SetUpSuite(c)
defer s.TearDownSuite(c)
s.SetUpTest(c)
defer s.TearDownTest(c)
charm := s.AddTestingCharm(c, "wordpress")
svc := s.AddTestingService(c, "wordpress", charm)
c.ResetTimer()
for i := 0; i < c.N; i++ {
_, err := svc.AddUnit()
c.Assert(err, gc.IsNil)
}
}
示例5: BenchmarkCreate
func (s *benchmarkSuite) BenchmarkCreate(c *gc.C) {
db := s.Session.DB("a-database")
store := blobstore.New(db, "prefix")
const fileSize = 30 * 1024
hasher := sha256.New()
c.ResetTimer()
for i := 0; i < c.N; i++ {
hasher.Reset()
src := newDataSource(int64(i), fileSize)
io.Copy(hasher, src)
hash := hex(hasher.Sum(nil))
exists, err := store.Create(hash, newDataSource(int64(i), fileSize))
c.Assert(err, gc.IsNil)
c.Assert(exists, gc.Equals, false)
}
}