src/hotspot/os/linux/os_perf_linux.cpp
changeset 51360 d2c720caa480
parent 50879 d90c3cbf13df
child 51366 292a9d391a20
equal deleted inserted replaced
51359:945ba9278a27 51360:d2c720caa480
  1105     return OS_ERR;
  1105     return OS_ERR;
  1106   }
  1106   }
  1107 
  1107 
  1108   NetworkInterface* ret = NULL;
  1108   NetworkInterface* ret = NULL;
  1109   for (cur_address = addresses; cur_address != NULL; cur_address = cur_address->ifa_next) {
  1109   for (cur_address = addresses; cur_address != NULL; cur_address = cur_address->ifa_next) {
  1110     if (cur_address->ifa_addr->sa_family != AF_PACKET) {
  1110     if ((cur_address->ifa_addr == NULL) || (cur_address->ifa_addr->sa_family != AF_PACKET)) {
  1111       continue;
  1111       continue;
  1112     }
  1112     }
  1113 
  1113 
  1114     int64_t bytes_in = read_counter(cur_address->ifa_name, "rx_bytes");
  1114     int64_t bytes_in = read_counter(cur_address->ifa_name, "rx_bytes");
  1115     int64_t bytes_out = read_counter(cur_address->ifa_name, "tx_bytes");
  1115     int64_t bytes_out = read_counter(cur_address->ifa_name, "tx_bytes");
  1116 
  1116 
  1117     NetworkInterface* cur = new NetworkInterface(cur_address->ifa_name, bytes_in, bytes_out, ret);
  1117     NetworkInterface* cur = new NetworkInterface(cur_address->ifa_name, bytes_in, bytes_out, ret);
  1118     ret = cur;
  1118     ret = cur;
  1119   }
  1119   }
  1120 
  1120 
       
  1121   freeifaddrs(addresses);
  1121   *network_interfaces = ret;
  1122   *network_interfaces = ret;
  1122 
  1123 
  1123   return OS_OK;
  1124   return OS_OK;
  1124 }
  1125 }
  1125 
  1126