It would be good to have only one thread for the same topic and not multiple.
@r.sander already gave you a working perf-o-meter only that it was not a 0 to 100 percent scale but logarithmic.
An example for 100 percent perf-o-meter looks like this one.
perfometer_info.append({
"type": "linear",
"segments": ["mem_used_percent"],
"total": 100.0,
})
And i say it again, please format your code in the posts - with your actual postings no one can say if there is an indentation error or not.