MCPcopy Index your code
hub / github.com/tensorflow/tensorboard / bench

Function bench

tensorboard/encode_png_benchmark.py:61–79  ·  view source on GitHub ↗

Encode `image` to PNG on `thread_count` threads in parallel. Returns: A `float` representing number of seconds that it takes all threads to finish encoding `image`.

(image, thread_count)

Source from the content-addressed store, hash-verified

59
60
61def bench(image, thread_count):
62 """Encode `image` to PNG on `thread_count` threads in parallel.
63
64 Returns:
65 A `float` representing number of seconds that it takes all threads
66 to finish encoding `image`.
67 """
68 threads = [
69 threading.Thread(target=lambda: encoder.encode_png(image))
70 for _ in range(thread_count)
71 ]
72 start_time = datetime.datetime.now()
73 for thread in threads:
74 thread.start()
75 for thread in threads:
76 thread.join()
77 end_time = datetime.datetime.now()
78 delta = (end_time - start_time).total_seconds()
79 return delta
80
81
82def _image_of_size(image_size):

Callers 1

mainFunction · 0.85

Calls 3

rangeFunction · 0.85
startMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…