Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
cache_spammer.h
Go to the documentation of this file.
1 /*
2  * Copyright 2010 Google Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http:///www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
17 
19 
20 #ifndef PAGESPEED_KERNEL_CACHE_CACHE_SPAMMER_H_
21 #define PAGESPEED_KERNEL_CACHE_CACHE_SPAMMER_H_
22 
27 #include "pagespeed/kernel/base/thread_annotations.h"
29 
30 namespace net_instaweb {
31 
32 class CacheInterface;
33 
37  public:
38  virtual ~CacheSpammer();
39 
46  static void RunTests(int num_threads, int num_iters, int num_inserts,
47  bool expecting_evictions, bool do_deletes,
48  const char* value_prefix,
49  CacheInterface* cache,
50  ThreadSystem* thread_runtime);
51 
53  void GetDone(bool found, StringPiece key);
54 
55  protected:
56  virtual void Run();
57 
58  private:
59  CacheSpammer(ThreadSystem* runtime,
60  ThreadSystem::ThreadFlags flags,
61  CacheInterface* cache,
62  bool expecting_evictions,
63  bool do_deletes,
64  const char* value_prefix,
65  int index,
66  int num_iters,
67  int num_inserts);
68 
69  CacheInterface* cache_;
70  bool expecting_evictions_;
71  bool do_deletes_;
72  const char* value_prefix_;
73  int index_;
74  int num_iters_;
75  int num_inserts_;
78  int pending_gets_ GUARDED_BY(mutex_);
79 
80 
81 };
82 
83 }
84 
85 #endif
void GetDone(bool found, StringPiece key)
Called when a Get completes.
Abstract interface for a cache.
Definition: cache_interface.h:32
static void RunTests(int num_threads, int num_iters, int num_inserts, bool expecting_evictions, bool do_deletes, const char *value_prefix, CacheInterface *cache, ThreadSystem *thread_runtime)
Definition: scoped_ptr.h:30
Definition: thread_system.h:40
Definition: cache_spammer.h:36
Base class for client thread code.
Definition: thread.h:34