你如何在本机CMD中每一次ping多次?

时间:2018-03-22 19:54:53

标签: cmd ping

我需要为每个项目多次ping一个项目,并且有人想要一台实时监控服务器启动的时间,并且他们想要高准确率。 这不是用于给药

1 个答案:

答案 0 :(得分:1)

您可以使用library(dplyr) library(tidyr) gather(df, key, samples) %>% separate(key, c("from", "to"), sep = "-") %>% group_by(grp = ifelse(samples >= 100 | lag(samples)<100,row_number(), row_number()+1)) %>% summarise(from = min(from), to = max(to), samples = sum(samples)) %>% select(-grp) %>% mutate(from = sprintf("%2s",from)) %>% unite("key", from, to, sep="-") %>% spread(key, samples) %>% as.data.frame() # 0-5 5-10 10-15 15-20 20-25 25-30 30-35 35-40 40-50 # 1 700 1000 1400 1700 1900 1500 1000 300 51 选项来控制间隔(以秒为单位)。您可以指定亚秒间隔,但请注意,只有超级用户可以将间隔设置为小于0.2秒:

findGroup <- function(x, targetVal = 100){
  grp <- seq_along(x)
  for(i in seq_along(x[-length(x)])){
    if(x[i] < targetVal){
      x[i+1] = x[i+1] + x[i]
      grp[i+1] = grp[i]
    }
  }
  grp
}

# Use findGroup function to organize data. Just line with `group_by` has been changed.
gather(df, key, samples) %>%
  separate(key, c("from", "to"), sep = "-") %>%
  group_by(grp = findGroup(samples)) %>%
  summarise(from = min(from), to = max(to), samples = sum(samples)) %>%
  select(-grp) %>%
  mutate(from = sprintf("%2s",from)) %>%
  unite("key", from, to, sep="-") %>%
  spread(key, samples) %>% as.data.frame()

#    0-5  5-10 10-15 15-20 20-25 25-30 30-35 35-40 40-50
# 1  700  1000  1400  1700  1900  1500  1000   300    51