Created
October 27, 2020 06:30
-
-
Save simonw/bb47311526d6cb8f79eb7b3d209938c2 to your computer and use it in GitHub Desktop.
Datasette plugin exposing rusage values
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import resource | |
from datasette import hookimpl | |
from datasette.utils.asgi import Response | |
def rusage(): | |
return Response.text( | |
repr(resource.getrusage(resource.RUSAGE_SELF)) | |
.replace(", ", ",\n ") | |
.replace("(", "(\n ") | |
) | |
@hookimpl | |
def register_routes(): | |
return [("^/-/rusage$", rusage)] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example output: