python_bublic_print_cli (#994)

This commit is contained in:
Alex Sharov 2020-08-28 14:19:34 +07:00 committed by GitHub
parent de16812a94
commit d73b036cff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,12 +36,13 @@ if cmd == "stats":
b = env.open_db(bucket.encode(), create=False) b = env.open_db(bucket.encode(), create=False)
with env.begin(write=False) as txn: with env.begin(write=False) as txn:
stat = txn.stat(b) stat = txn.stat(b)
data["name"].append(bucket) size = stat['psize'] * (stat['branch_pages'] + stat['leaf_pages'] + stat['overflow_pages'])
data["size"].append(stat['psize'] * (stat['branch_pages'] + stat['leaf_pages'] + stat['overflow_pages'])) print("%s: %dMb" % (bucket, size/1024/1024))
# data["name"].append(bucket)
df = pd.DataFrame.from_dict(data) # data["size"].append(stat['psize'] * (stat['branch_pages'] + stat['leaf_pages'] + stat['overflow_pages']))
fig = px.pie(df, values='size', names='name', title='Buckets size') # df = pd.DataFrame.from_dict(data)
fig.show() # fig = px.pie(df, values='size', names='name', title='Buckets size')
# fig.show()
elif cmd == "gas_limits": elif cmd == "gas_limits":
StartedWhenBlockNumber = chain.lastBlockNumber(env) StartedWhenBlockNumber = chain.lastBlockNumber(env)