Simplest and stupidiest threaded executer.
Definition at line 145 of file ab.py.
◆ __init__()
ab.ThreadRunner.__init__ |
( |
|
self, |
|
|
|
args |
|
) |
| |
Definition at line 147 of file ab.py.
147 def __init__(self, args):
148 self.concise = args.concise
149 self.threads = []
150
◆ add()
ab.ThreadRunner.add |
( |
|
self, |
|
|
|
args, |
|
|
|
fn |
|
) |
| |
Definition at line 151 of file ab.py.
151 def add(self, args, fn):
152 if len(self.threads) >= args.threads:
153 self.wait()
154 t = ThreadWithException(target = fn)
155 t.daemon = True
157 t.start()
158
static void append(char **dst, size_t *count, const char *src, size_t n)
◆ wait()
ab.ThreadRunner.wait |
( |
|
self | ) |
|
Definition at line 159 of file ab.py.
159 def wait(self):
161 i = 0
162 spinners = [". ", ".. ", "..."]
163 while len(self.threads) > 0:
164 timesLock.acquire()
165 sys.stderr.write(
166 "\r" + spinners[i % len(spinners)] +
167 " (%d threads running)" % len(self.threads) +
168 " \r"
169 )
170 timesLock.release()
171 time.sleep(0.5)
172 i += 1
173
174 if not self.concise:
175 ts =
Thread(target = spin);
176 ts.start()
177
178 for t in self.threads:
179 t.join()
180
181 exceptions = []
182 for t in self.threads:
183 if t.exception:
184 exceptions.append(t.exception)
185
186 self.threads = []
187
188 if not self.concise:
189 ts.join()
190
191 if len(exceptions):
192 for exc in exceptions:
194 raise exceptions[0]
195
196
static sk_sp< SkColorFilter > spin(sk_sp< SkColorFilter > cf)
◆ concise
◆ threads
The documentation for this class was generated from the following file:
- third_party/skia/tools/calmbench/ab.py