我正在使用代表运行总计的指标。
峰值间隔30秒,让我觉得计数每30秒存储一次。我的目标是能够在每个“$ window”(模板变量,例如:1分钟,30分钟)中看到运行总计中的增量。如果我的窗口是30秒并且两个连续计数之间的差值是5,我希望看到一个“5”数据点。如果我的窗口是1分钟,那么它将是3个峰值之间的差值。
我的理解是import java.io.*;
import java.util.Scanner;
public class Main {
public static String fileName = "Users/bobsmith/Desktop/tasklistjava/src/javatask.txt";
public static void main(String[] args) throws IOException {
int menuItem = -1;
while(menuItem != 0){
menuItem = menu();
switch (menuItem){
case 1:
showTaskList();
break;
case 2:
addTask();
break;
case 3:
sortList();
break;
case 0:
break;
default:
System.out.println("Invalid Input");
}
}
}
static int menu(){
int choice;
Scanner sc = new Scanner(System.in);
System.out.println("\n Task List Menu \n");
System.out.println("0: Exit Menu");
System.out.println("1: Show Tasks in List");
System.out.println("2: Add Task to List");
System.out.println("3: Sort Tasks by Due Date");
System.out.println();
System.out.println("Enter a Task: ");
choice = sc.nextInt();
return choice;
}
static void showTaskList(){
System.out.println("\nTask List\n");
try {
Scanner inFile = new Scanner(new FileReader(fileName));
String line;
int number = 1;
while(inFile.hasNextLine()){
line = inFile.nextLine();
System.out.println(number + " ");
System.out.println(line);
++number;
}
System.out.println();
inFile.close();
} catch (FileNotFoundException ioe) {
System.out.println("Can't Access File");
}
}
static void addTask(){
System.out.println("\nAdd Task\n");
try {
Scanner input = new Scanner(System.in);
PrintWriter outFile = new PrintWriter(new FileWriter(fileName, true));
System.out.println("Enter a Task: ");
String addedTask = input.nextLine();
System.out.println("You Must set a Due Date for this task: ");
String dueDate = input.nextLine();
outFile.println(addedTask + " " + dueDate);
outFile.close();
} catch (IOException ioe) {
System.out.println("Can't Access File");
}
}
static void sortList(){}
}
会有所帮助,但它会产生一个恒定的0行。我想这与图的尖性有关。我一直在玩derivative
和hitcount
,但我似乎没有得到正确的数字。有什么建议吗?
perSecond
。
想法是使用summarize(derivative(summarize(my.metric, "30s")), "$window")
强制执行30秒的最小分辨率(因为我每30秒只有1个数据点)。然后,我使用summarize(my.metric, "30s")
来获取更改率,最后使用我的模板化derivative
summarize
来按照我感兴趣的时间间隔对变化率求和。任何评论?< / p>
答案 0 :(得分:2)
使用{{1}}工作。