<s> import struct <EOL> import operator <EOL> import sysctl <EOL> from functools import reduce <EOL> def get_current_mbufs ( ) : <EOL> data = sysctl . sysctl ( '<STR_LIT>' ) <EOL> nelems = len ( data ) / <NUM_LIT:4> <EOL> nums = struct . unpack ( nelems * '<STR_LIT:l>' , data ) <EOL> free = nums [ <NUM_LIT:0> ] <EOL> return free , reduce ( operator . add , nums [ <NUM_LIT:1> : ] ) <EOL> def get ( ) : <EOL> ( peak_mbufs , clusters , spare , clfree , <EOL> drops , wait , drain , mcfail , mpfail , <EOL> msize , mclbytes , minclsize , mlen , mhlen <EOL> ) = struct . unpack ( <NUM_LIT> * '<STR_LIT:l>' , sysctl . sysctl ( '<STR_LIT>' ) ) <EOL> ( max_mbufs , ) = struct . unpack ( '<STR_LIT:l>' , sysctl . sysctl ( '<STR_LIT>' ) ) <EOL> ( max_mbclusters , ) = struct . unpack ( '<STR_LIT:l>' , sysctl . sysctl ( '<STR_LIT>' ) ) <EOL> free_mbufs , current_mbufs = get_current_mbufs ( ) <EOL> return locals ( ) </s>
