(String filename)
| 132 | } |
| 133 | |
| 134 | public static synchronized void dump(String filename) throws IOException { |
| 135 | Collections.sort(samples, new Comparator<Sample>() { |
| 136 | |
| 137 | @Override |
| 138 | public int compare(Sample o1, Sample o2) { |
| 139 | return Double.compare(o1.start, o2.start); |
| 140 | } |
| 141 | |
| 142 | }); |
| 143 | |
| 144 | try (PrintStream out = new PrintStream(new FileOutputStream(filename))) { |
| 145 | out.println("start,end,name,user1,user2,thread,frame"); |
| 146 | double min = Double.MAX_VALUE; |
| 147 | for (Sample s : samples) { |
| 148 | min = Math.min(min, s.start); |
| 149 | } |
| 150 | for (Sample s : samples) { |
| 151 | out.format("%f,%f,%s,%s,%s,%s,%s,%n", s.start - min, s.end - min, s.name, s.user1, s.user2, s.thread, s.frame); |
| 152 | } |
| 153 | System.out.format("Profile %s written%n", filename); |
| 154 | } catch (FileNotFoundException e) { |
| 155 | throw new IOException(e); |
| 156 | } |
| 157 | |
| 158 | } |
| 159 | } |
no test coverage detected