TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Show HN: hazelnut – A pythonic library to parse /proc/meminfo

33 pointsby mrsmnabout 9 years ago

5 comments

franciscopabout 9 years ago
I happened to have hazelnut.io until recently. Unfortunately I let it expire since the original project I was planning on using there was much more complex than anticipated. So now it&#x27;s parked by someone else [1], otherwise it was yours<p>[1] <a href="http:&#x2F;&#x2F;who.is&#x2F;whois&#x2F;hazelnut.io" rel="nofollow">http:&#x2F;&#x2F;who.is&#x2F;whois&#x2F;hazelnut.io</a>
评论 #11274279 未加载
Goopplesoftabout 9 years ago
The API of this lib is probably surprising for the typical use-cases because a MemInfo object only represents a path and not a reading&#x2F;snapshot of the file (each subsequent call to get() re-reads the meminfo file).<p>&gt; <a href="https:&#x2F;&#x2F;github.com&#x2F;mrsmn&#x2F;hazelnut&#x2F;blob&#x2F;master&#x2F;hazelnut&#x2F;core.py#L33" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;mrsmn&#x2F;hazelnut&#x2F;blob&#x2F;master&#x2F;hazelnut&#x2F;core....</a><p>So usage like:<p><pre><code> snap_pre = MemInfo() # Do stuff here snap_post = MemInfo() snap_pre.get(&#x27;Mem&#x27;) snap_post.get(&#x27;Mem&#x27;) snap_post.get(&#x27;Mem&#x27;) # All three would likely give different values. </code></pre> I would suggest caching the read on instantiation or making them top level functions instead of using a class or MemInfoPath()?
srcmapabout 9 years ago
You can cross reference of &#x2F;proc&#x2F;meminfo output into the kernel source code here:<p><a href="http:&#x2F;&#x2F;www.srcmap.org&#x2F;sd_share&#x2F;7&#x2F;28338946&#x2F;Code_Trace_of_Linux_Kernel_proc_meminfo.html" rel="nofollow">http:&#x2F;&#x2F;www.srcmap.org&#x2F;sd_share&#x2F;7&#x2F;28338946&#x2F;Code_Trace_of_Linu...</a>
tobltobsabout 9 years ago
What are those keys in your donate paragraph?
评论 #11274442 未加载
ccannonabout 9 years ago
How is this different than psutil?
评论 #11288482 未加载