blob: eb5a6c755f54aa975b0b344d3ed428bcf246fbe2 [file] [log] [blame]
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.weex.utils.tools;
import com.alibaba.fastjson.annotation.JSONField;
public class Time {
@JSONField(name = "taskStart")
public long taskStart;
@JSONField(name = "execTime")
public long execTime;
@JSONField(name = "constructor")
public long constructor;
@JSONField(name = "destructor")
public long destructor;
@JSONField(name = "taskEnd")
public long taskEnd;
@JSONField(name = "waitTime")
public long waitTime;
@Override
public String toString() {
return
"time : {" +
"constructor = '" + constructor + '\'' +
",taskStart = '" + taskStart + '\'' +
",execTime = '" + execTime + '\'' +
",waitTime = '" + waitTime + '\'' +
",destructor = '" + destructor + '\'' +
",taskEnd = '" + taskEnd + '\'' +
"}";
}
protected void constructor() {
constructor = System.currentTimeMillis();
}
public void execTime() {
execTime = taskEnd - taskStart;
}
public void taskStart() {
taskStart = System.currentTimeMillis();
}
public void taskEnd() {
taskEnd = System.currentTimeMillis();
execTime();
destructor();
}
private void destructor() {
waitTime();
destructor = System.currentTimeMillis();
}
public void waitTime() {
waitTime = taskStart - constructor;
}
}