mirror of
https://gitee.com/BDWare/agent-backend
synced 2025-01-10 18:04:13 +00:00
42 lines
784 B
Plaintext
42 lines
784 B
Plaintext
|
@LogType("Arg")
|
||
|
@Permission("CM")
|
||
|
contract GasExample{
|
||
|
event abcEvent;
|
||
|
|
||
|
@Cost({"countGas":true,"extraGas":"getExecTimes"})
|
||
|
export function pub(arg){
|
||
|
a =1+1;
|
||
|
b =2+2;
|
||
|
Global.tigger=new Date();
|
||
|
abcEvent(arg);
|
||
|
if(arg.length>10){
|
||
|
return "done!";
|
||
|
}
|
||
|
else{
|
||
|
return 11;
|
||
|
}
|
||
|
}
|
||
|
export function log(arg){
|
||
|
var data=new Date().getTime()-Global.tigger.getTime();
|
||
|
print(data);
|
||
|
for(var i=0;i<arg.length;i++){
|
||
|
if(arg.length<i*2){
|
||
|
print("smaller");
|
||
|
pub(arg);
|
||
|
}
|
||
|
else{
|
||
|
print("larger");
|
||
|
}
|
||
|
}
|
||
|
return data;
|
||
|
}
|
||
|
function onCreate(){
|
||
|
Global.tigger=new Date();
|
||
|
}
|
||
|
|
||
|
export function getExecTimes(arg) {
|
||
|
var times = CMUtil.getTimesOfExecution("GasExample");
|
||
|
return times;
|
||
|
}
|
||
|
}
|