Closed Comradin closed 5 years ago
Hello,
I use a simple loop to iterate over the keys and values of the map Stats() returns:
stats, err := ethtool.Stats(device) if err != nil { panic(err) } for key, value := range stats { if strings.HasPrefix(key, "ptp_") { fmt.Printf("Key: %v, Value: %v.\n", key, value) } }
But this results in output, that is filled with special characters like this: Key: ptp_good_syncs���� Value: 76414806 Key: ptp_bad_syncs�q Value: 2 Key: ptp_non_filter_matches Value: 0 Key: ptp_invalid_sync_windows���K��� Value: 0 Key: ptp_filter_matches ���� Value: 0 Key: ptp_undersize_sync_windows��� Value: 22259 Key: ptp_no_time_syncs Value: 2 Key: ptp_oversize_sync_windows Value: 19631 Key: ptp_rx_timestamp_packets� Value: 0 Key: ptp_sync_timeouts Value: 20 Key: ptp_fast_syncs��cg�����pK����� Value: 74814754 Key: ptp_rx_no_timestamp Value: 0 Key: ptp_tx_timestamp_packets��8 Value: 70378 Key: ptp_timestamp_packetsa{U{UValue: 70378
or it looks like there are values in my string like this (withtout the HasPrefix() filtering Key: tx-9.tx_packets2235 624160 1684 Value: 91028224 Key: tx-10.tx_packets0 0 0 0 0 0 0 0 Value: 101749747 Key: tx-19.tx_packets0 0 0 0 0 0 0 0 Value: 137001195 Key: tx-20.tx_packets0 0 0 0 0 0 0 0 Value: 103459984 Key: ptp_no_time_syncs 0 0 0 0 0 0 0 Value: 2
Any ideas on why this happens, am I doing something wrong?
Regards, Marcus
Hello,
I use a simple loop to iterate over the keys and values of the map Stats() returns:
But this results in output, that is filled with special characters like this: Key: ptp_good_syncs���� Value: 76414806 Key: ptp_bad_syncs�q Value: 2 Key: ptp_non_filter_matches Value: 0 Key: ptp_invalid_sync_windows���K��� Value: 0 Key: ptp_filter_matches ���� Value: 0 Key: ptp_undersize_sync_windows��� Value: 22259 Key: ptp_no_time_syncs Value: 2 Key: ptp_oversize_sync_windows Value: 19631 Key: ptp_rx_timestamp_packets� Value: 0 Key: ptp_sync_timeouts Value: 20 Key: ptp_fast_syncs��cg�����pK����� Value: 74814754 Key: ptp_rx_no_timestamp Value: 0 Key: ptp_tx_timestamp_packets��8 Value: 70378 Key: ptp_timestamp_packetsa{U{UValue: 70378
or it looks like there are values in my string like this (withtout the HasPrefix() filtering Key: tx-9.tx_packets2235 624160 1684 Value: 91028224 Key: tx-10.tx_packets0 0 0 0 0 0 0 0 Value: 101749747 Key: tx-19.tx_packets0 0 0 0 0 0 0 0 Value: 137001195 Key: tx-20.tx_packets0 0 0 0 0 0 0 0 Value: 103459984 Key: ptp_no_time_syncs 0 0 0 0 0 0 0 Value: 2
Any ideas on why this happens, am I doing something wrong?
Regards, Marcus