def dump_h5(filename, server, port=11211): client = pymemcache.client.Client((server, port)) stats = client.stats("slabs") slab_index = set(int(k.split(b":")[0]) for k in stats if b":" in k) print(slab_index) with h5py.File(filename, "w") as h5: entry = h5.require_group(get_isotime()) for idx in slab_index: keys = stats.get(b"%i:cmd_set" % idx, 0) print("Slab #%s: %s keys" % (idx, keys)) if keys: for key in client.stats("cachedump", str(idx), str(keys)): ukey = key.decode() print(" " + ukey) entry[ukey] = numpy.frombuffer(client.get(key), dtype="uint8")
def test_from(self): t0 = time.perf_counter() isotime = io.get_isotime(t0) self.assertTrue( abs(t0 - io.from_isotime(isotime)) < 1, "timing are precise to the second")
def test_get(self): self.assertTrue(len(io.get_isotime()), 25)
def test_from(self): t0 = time.time() isotime = io.get_isotime(t0) self.assertTrue(abs(t0 - io.from_isotime(isotime)) < 1, "timing are precise to the second")
def test_from(self): t0 = time.time() isotime = io.get_isotime(t0) self.assert_( abs(t0 - io.from_isotime(isotime)) < 1, "timing are precise to the second")