本文整理汇总了Java中scouter.util.DateUtil.getDateMillis方法的典型用法代码示例。如果您正苦于以下问题:Java DateUtil.getDateMillis方法的具体用法?Java DateUtil.getDateMillis怎么用?Java DateUtil.getDateMillis使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类scouter.util.DateUtil
的用法示例。
在下文中一共展示了DateUtil.getDateMillis方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getYesterdayData
import scouter.util.DateUtil; //导入方法依赖的package包/类
private void getYesterdayData(String date) {
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
List<Pack> out = null;
try {
MapPack param = new MapPack();
param.put("counter", this.counter);
param.put("date", date);
param.put("objType", this.objType);
out = tcp.process(RequestCmd.COUNTER_PAST_DATE_ALL, param);
} catch (Throwable t) {
ConsoleProxy.errorSafe(t.toString());
} finally {
TcpProxy.putTcpProxy(tcp);
}
final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
if (out != null) {
Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, out, mode, TimeTypeEnum.FIVE_MIN);
Iterator<Long> itr = valueMap.keySet().iterator();
while (itr.hasNext()) {
long time = itr.next();
int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
values[index] += valueMap.get(time);
}
}
ExUtil.exec(this.canvas, new Runnable() {
public void run() {
CircularBufferDataProvider yesterdayProvider = (CircularBufferDataProvider) yesterdayTrace.getDataProvider();
yesterdayProvider.clearTrace();
for (int i = 0; i < values.length; i++) {
yesterdayProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
}
yesterdayMax = ChartUtil.getMax(yesterdayProvider.iterator());
}
});
}
示例2: _offset
import scouter.util.DateUtil; //导入方法依赖的package包/类
private int _offset(long time) {
int seconds = DateUtil.getDateMillis(time) / 500;
int hash = seconds % capacity;
return _keyLength * hash + _memHeadReserved;
}
示例3: refresh
import scouter.util.DateUtil; //导入方法依赖的package包/类
public void refresh() {
ScouterUtil.collectGroupObjcts(grpName, serverObjMap);
isActive = false;
Iterator<Integer> serverIds = serverObjMap.keySet().iterator();
final List<Pack> result = new ArrayList<Pack>();
while (serverIds.hasNext()) {
int serverId = serverIds.next();
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
try {
MapPack param = new MapPack();
param.put("counter", counter);
param.put("objHash", serverObjMap.get(serverId));
tcp.process(RequestCmd.COUNTER_TODAY_GROUP, param, new INetReader() {
public void process(DataInputX in) throws IOException {
Pack p = in.readPack();
if (p != null) {
result.add(p);
}
}
});
} catch (Exception e) {
e.printStackTrace();
} finally {
TcpProxy.putTcpProxy(tcp);
}
}
final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
if (result.size() > 0) {
Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, result, mode, TimeTypeEnum.FIVE_MIN);
Iterator<Long> itr = valueMap.keySet().iterator();
while (itr.hasNext()) {
long time = itr.next();
int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
values[index] += valueMap.get(time);
}
isActive = true;
}
ExUtil.exec(this.canvas, new Runnable() {
public void run() {
if (isActive == true) {
setActive();
} else {
setInactive();
return;
}
double max = 0;
traceDataProvider.clearTrace();
for (int i = 0; i < values.length; i++) {
traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
}
max = Math.max(ChartUtil.getMax(traceDataProvider.iterator()), max);
if (CounterUtil.isPercentValue(objType, counter)) {
xyGraph.primaryYAxis.setRange(0, 100);
} else {
xyGraph.primaryYAxis.setRange(0, max);
}
canvas.redraw();
xyGraph.repaint();
}
});
}
示例4: load
import scouter.util.DateUtil; //导入方法依赖的package包/类
public void load() {
ScouterUtil.collectGroupObjcts(grpName, serverObjMap);
Iterator<Integer> serverIds = serverObjMap.keySet().iterator();
final List<Pack> result = new ArrayList<Pack>();
while (serverIds.hasNext()) {
int serverId = serverIds.next();
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
try {
MapPack param = new MapPack();
param.put("counter", counter);
param.put("date", date);
param.put("objHash", serverObjMap.get(serverId));
tcp.process(RequestCmd.COUNTER_PAST_DATE_GROUP, param, new INetReader() {
public void process(DataInputX in) throws IOException {
Pack p = in.readPack();
if (p != null) {
result.add(p);
}
}
});
} catch (Exception e) {
e.printStackTrace();
} finally {
TcpProxy.putTcpProxy(tcp);
}
}
final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
if (result.size() > 0) {
Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, result, mode, TimeTypeEnum.FIVE_MIN);
Iterator<Long> itr = valueMap.keySet().iterator();
while (itr.hasNext()) {
long time = itr.next();
int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
values[index] += valueMap.get(time);
}
}
ExUtil.exec(this.canvas, new Runnable() {
public void run() {
double max = 0;
traceDataProvider.clearTrace();
for (int i = 0; i < values.length; i++) {
traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
}
max = Math.max(ChartUtil.getMax(traceDataProvider.iterator()), max);
if (CounterUtil.isPercentValue(objType, counter)) {
xyGraph.primaryYAxis.setRange(0, 100);
} else {
xyGraph.primaryYAxis.setRange(0, max);
}
canvas.redraw();
xyGraph.repaint();
}
});
}
示例5: run
import scouter.util.DateUtil; //导入方法依赖的package包/类
protected IStatus run(IProgressMonitor monitor) {
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
List<Pack> out = null;
try {
MapPack param = new MapPack();
param.put("date", date);
param.put("counter", counter);
param.put("objType", objType);
out = tcp.process(RequestCmd.COUNTER_PAST_DATE_ALL, param);
} catch (Throwable t) {
ConsoleProxy.errorSafe(t.toString());
} finally {
TcpProxy.putTcpProxy(tcp);
}
final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
if (out != null) {
Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, out, mode, TimeTypeEnum.FIVE_MIN);
Iterator<Long> itr = valueMap.keySet().iterator();
while (itr.hasNext()) {
long time = itr.next();
int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
values[index] += valueMap.get(time);
}
}
ExUtil.exec(canvas, new Runnable() {
public void run() {
double max = 0;
traceDataProvider.clearTrace();
for (int i = 0; i < values.length; i++) {
traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
}
max = Math.max(ChartUtil.getMax(traceDataProvider.iterator()), max);
if (CounterUtil.isPercentValue(objType, counter)) {
xyGraph.primaryYAxis.setRange(0, 100);
} else {
xyGraph.primaryYAxis.setRange(0, max);
}
redraw();
}
});
return Status.OK_STATUS;
}
示例6: refresh
import scouter.util.DateUtil; //导入方法依赖的package包/类
public void refresh() {
String date = DateUtil.yyyymmdd(TimeUtil.getCurrentTime(serverId) - DateUtil.MILLIS_PER_DAY);
if (date.equals(yesterday) == false) {
yesterday = date;
getYesterdayData(date);
}
isActive = false;
TcpProxy tcp = TcpProxy.getTcpProxy(serverId);
List<Pack> out = null;
try {
MapPack param = new MapPack();
param.put("counter", this.counter);
param.put("objType", this.objType);
out = tcp.process(RequestCmd.COUNTER_TODAY_ALL, param);
} catch (Throwable t) {
ConsoleProxy.errorSafe(t.toString());
} finally {
TcpProxy.putTcpProxy(tcp);
}
final long[] values = new long[(int)(DateUtil.MILLIS_PER_DAY / DateUtil.MILLIS_PER_HOUR)];
if (out != null && out.size() > 0) {
Map<Long, Double> valueMap = ScouterUtil.getLoadTotalMap(counter, out, mode, TimeTypeEnum.FIVE_MIN);
Iterator<Long> itr = valueMap.keySet().iterator();
while (itr.hasNext()) {
long time = itr.next();
int index = (int) (DateUtil.getDateMillis(time) / DateUtil.MILLIS_PER_HOUR);
values[index] += valueMap.get(time);
}
isActive = true;
}
ExUtil.exec(this.canvas, new Runnable() {
public void run() {
if (isActive == true) {
setActive();
traceDataProvider.clearTrace();
for (int i = 0; i < values.length; i++) {
traceDataProvider.addSample(new Sample(CastUtil.cdouble(i) + 0.5d, CastUtil.cdouble(values[i])));
}
} else {
setInactive();
}
if (CounterUtil.isPercentValue(objType, counter)) {
xyGraph.primaryYAxis.setRange(0, 100);
} else {
double max = ChartUtil.getMax(traceDataProvider.iterator());
max = Math.max(max, yesterdayMax);
xyGraph.primaryYAxis.setRange(0, max);
}
canvas.redraw();
xyGraph.repaint();
}
});
}