/
PerfLogger.java
39 lines (35 loc) · 944 Bytes
/
PerfLogger.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package com.mobilebytes.andlog;
//TODO: Auto-generated Javadoc
/**
* The Class PerfLogger.
*
* @author fredgrott
*/
public class PerfLogger {
/** The Constant MILLISECONDSPERSECOND. */
private static final int MILLISECONDSPERSECOND = 1000;
/** The start time. */
private static long startTime = 0;
/**
* Start.
*
* @param tagName
* the tag name
*/
public static void start(String tagName) {
startTime = System.currentTimeMillis();
CustomLogger.d(tagName, "started PerfLogger");
}
/**
* Stop.
*
* @param tagName
* the tag name
*/
public static void stop(String tagName) {
double d = (System.currentTimeMillis() - startTime)
/ MILLISECONDSPERSECOND;
CustomLogger.d(tagName, "Fine PerfTrace\nTag: " + tagName
+ "\nTime spent: " + d + " s.");
}
}