(self, iface, sckt)
return all_names
Retrieve names of all ethtool stats for given interface.
Retrieve names of all ethtool stats for given interface.
Retrieve names of all ethtool stats for given interface .
def _get_ethtool_gstringset(self, iface, sckt):
        """
        Retrieve names of all ethtool stats for given interface.
        """
        sset_info = array.array('B', struct.pack('IIQI', ETHTOOL_GSSET_INFO, 0, 1 << ETH_SS_STATS, 0))
        self._send_ethtool_ioctl(iface, sckt, sset_info)
        sset_mask, sset_len = struct.unpack('8xQI', sset_info)
        if sset_mask == 0:
            sset_len = 0

        strings = array.array('B', struct.pack('III', ETHTOOL_GSTRINGS, ETH_SS_STATS, sset_len))
        strings.extend([0] * sset_len * ETH_GSTRING_LEN)
        self._send_ethtool_ioctl(iface, sckt, strings)

        all_names = []
        for i in range(sset_len):
            offset = 12 + ETH_GSTRING_LEN * i
            s = strings[offset : offset + ETH_GSTRING_LEN]
            s = s.tobytes() if PY3 else s.tostring()
            s = s.partition(b'\x00')[0].decode('utf-8')
            all_names.append(s)
        return all_names
def _get_ethtool_gstringset ( self , iface , sckt ) : sset_info = array . array ( 'B' , struct . pack ( 'IIQI' , ETHTOOL_GSSET_INFO , 0 , 1 << ETH_SS_STATS , 0 ) ) self . _send_ethtool_ioctl ( iface , sckt , sset_info ) sset_mask , sset_len = struct . unpack ( '8xQI' , sset_info ) if sset_mask == 0 : sset_len = 0 strings = array . array ( 'B' , struct . pack ( 'III' , ETHTOOL_GSTRINGS , ETH_SS_STATS , sset_len ) ) strings . extend ( [ 0 ] * sset_len * ETH_GSTRING_LEN ) self . _send_ethtool_ioctl ( iface , sckt , strings ) all_names = [ ] for i in range ( sset_len ) : offset = 12 + ETH_GSTRING_LEN * i s = strings [ offset : offset + ETH_GSTRING_LEN ] s = s . tobytes ( ) if PY3 else s . tostring ( ) s = s . partition ( b'\x00' ) [ 0 ] . decode ( 'utf-8' ) all_names . append ( s ) return all_names