This file contains hidden or 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
-- https://psutil.readthedocs.io/en/latest/#psutil.Process.memory_full_info | |
-- Linux: 0=rss, 1=vms, 2=shared, 3=text, 4=lib, 5=data, 6=dirty, 7=uss, 8=pss, 9=swap | |
CREATE OR REPLACE FUNCTION get_memory_info(pid INTEGER DEFAULT NULL, memtype INTEGER DEFAULT 0) | |
RETURNS BIGINT | |
AS | |
$$ | |
import psutil | |
p = psutil.Process(pid) | |
return p.memory_full_info()[memtype] | |
$$ |