Skip to content

Commit

Permalink
Merge pull request FISCO-BCOS#307 from FISCO-BCOS/release-2.0.0-rc3
Browse files Browse the repository at this point in the history
sync Release 2.0.0 rc3
  • Loading branch information
bxq2011hust authored Jun 13, 2019
2 parents 9054e6a + 08b36a9 commit 38c4a7f
Show file tree
Hide file tree
Showing 11 changed files with 657 additions and 658 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/fisco/bcos/channel/client/Service.java
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,7 @@ public void run(Timeout timeout) throws Exception {
bcosMessage.getSeq());

} catch (Exception e) {
logger.error("system error: " + e.getMessage());
logger.error("system error: " + e);

BcosResponse response = new BcosResponse();
response.setErrorCode(-1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public void run() {
}
});
}

} catch (RejectedExecutionException e) {
logger.error("threadPool is full, reject to request", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ public void onConnect(ChannelHandlerContext ctx) {
ctx.writeAndFlush(out);

queryBlockNumberForSelectNodes(ctx);

} catch (Exception e) {
logger.error("error:", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public void retrySendRemoteMessage() {
} else {
// ethereum消息,不用改类型
}

message.setResult(99);

ByteBuf out = localConnection.alloc().buffer();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,12 @@ public SendTransaction sendTransaction(
Request<?, SendTransaction> request = web3j.sendRawTransaction(signedTransaction);
request.setNeedTransCallback(true);
request.setTransactionSucCallback(callback);
SendTransaction ethSendTransaction = request.send();

request.sendOnly();

return null;

/*
if (ethSendTransaction != null && !ethSendTransaction.hasError()) {
String txHashLocal = Hash.sha3(signedTransaction);
String txHashRemote = ethSendTransaction.getTransactionHash();
Expand All @@ -180,6 +184,7 @@ public SendTransaction sendTransaction(
}
return ethSendTransaction;
*/
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,10 @@ public void onResponse(TransactionReceipt receipt) {

if (callBackType.compareTo("set") == 0) { // add test
dagUserMgr.addUser(user);
} else if (callBackType.compareTo("transfer") == 0
|| callBackType.compareTo("transferRevert") == 0) { // transfer test
} else if (callBackType.compareTo("transfer") == 0) { // transfer test
fromUser.decrease(amount);
toUser.increase(amount);
} else if (callBackType.compareTo("transferRevert") == 0) { // tranfer revert test
fromUser.decrease(amount);
toUser.increase(amount);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package org.fisco.bcos.channel.test.parallel.parallelok;

import de.vandermeer.asciitable.AsciiTable;
import de.vandermeer.skb.interfaces.transformers.textformat.TextAlignment;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong;
import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt;
Expand Down Expand Up @@ -47,7 +45,7 @@ public boolean isEnd() {
public void onMessage(TransactionReceipt receipt, Long cost) {
try {
if (!receipt.isStatusOK()) {
// System.out.println("receipt error! status: " + receipt.getStatus());
System.out.println("receipt error! status: " + receipt.getStatus());
error.addAndGet(1);
}

Expand Down Expand Up @@ -85,90 +83,71 @@ public void onMessage(TransactionReceipt receipt, Long cost) {
totalCost.addAndGet(cost);

if (isEnd()) {
System.out.println("total");

//
Long totalTime = System.currentTimeMillis() - startTimestamp;

System.out.println(
"===================================================================");
System.out.println("Summary");

System.out.println("Total transactions: " + String.valueOf(total));
System.out.println("Total time: " + String.valueOf(totalTime) + "ms");
System.out.println("TPS: " + String.valueOf(total / ((double) totalTime / 1000)));
System.out.println(
"===================================================================");
"Avg time cost: " + String.valueOf(totalCost.get() / total) + "ms");
System.out.println(
"Error rate: "
+ String.valueOf(((double)error.get() / (double)received.get()) * 100)
+ "%");
System.out.println(
"Return Error rate: "
+ String.valueOf(((double)ret_error.get() / (double)received.get()) * 100)
+ "%");

AsciiTable at = new AsciiTable();
at.addRule();
at.addRow(null, "Performance");
at.addRule();
at.addRow("Total transactions", total);
at.addRule();
at.addRow("Total sent", total - error.get());
at.addRule();
at.addRow("Total error", error.get());
at.addRule();
at.addRow("Error rate", (error.get() / (double) received.get()) * 100 + "%");
at.addRule();
at.addRow(
"Return error rate",
(ret_error.get() / (double) received.get()) * 100 + "%");
at.addRule();
at.addRow("Elapsed time", totalTime + " ms");
at.addRule();
at.addRow(
"TPS",
String.format("%.2f", (total - error.get()) / ((double) totalTime / 1000)));
at.addRule();

at.getContext().setWidth(40);
at.setTextAlignment(TextAlignment.CENTER);

String atRender = at.render();
System.out.println(atRender + "\n");

at = new AsciiTable();
at.addRule();
at.addRow(null, null, "Time Area");
at.addRule();
at.addRow(
"0 < time < 50ms",
less50,
String.format("%.2f%%", (double) less50.get() / total * 100));
at.addRule();
at.addRow(
"50 < time < 100ms",
less100,
String.format("%.2f%%", (double) less100.get() / total * 100));
at.addRule();
at.addRow(
"100 < time < 200ms",
less200,
String.format("%.2f%%", (double) less200.get() / total * 100));
at.addRule();
at.addRow(
"200 < time < 400ms",
less400,
String.format("%.2f%%", (double) less400.get() / total * 100));
at.addRule();
at.addRow(
"400 < time < 1000ms",
less1000,
String.format("%.2f%%", (double) less1000.get() / total * 100));
at.addRule();
at.addRow(
"1000 < time < 2000ms",
less2000,
String.format("%.2f%%", (double) less2000.get() / total * 100));
at.addRule();
at.addRow(
"2000 < time",
timeout2000,
String.format("%.2f%%", (double) timeout2000.get() / total * 100));
at.addRule();
at.addRow("Average time cost", null, totalCost.get() / total + " ms");
at.addRule();

at.getContext().setWidth(80);
at.setTextAlignment(TextAlignment.CENTER);

atRender = at.render();
System.out.println(atRender);
System.out.println("Time area:");
System.out.println(
"0 < time < 50ms : "
+ String.valueOf(less50)
+ " : "
+ String.valueOf((double) less50.get() / total * 100)
+ "%");
System.out.println(
"50 < time < 100ms : "
+ String.valueOf(less100)
+ " : "
+ String.valueOf((double) less100.get() / total * 100)
+ "%");
System.out.println(
"100 < time < 200ms : "
+ String.valueOf(less200)
+ " : "
+ String.valueOf((double) less200.get() / total * 100)
+ "%");
System.out.println(
"200 < time < 400ms : "
+ String.valueOf(less400)
+ " : "
+ String.valueOf((double) less400.get() / total * 100)
+ "%");
System.out.println(
"400 < time < 1000ms : "
+ String.valueOf(less1000)
+ " : "
+ String.valueOf((double) less1000.get() / total * 100)
+ "%");
System.out.println(
"1000 < time < 2000ms : "
+ String.valueOf(less2000)
+ " : "
+ String.valueOf((double) less2000.get() / total * 100)
+ "%");
System.out.println(
"2000 < time : "
+ String.valueOf(timeout2000)
+ " : "
+ String.valueOf((double) timeout2000.get() / total * 100)
+ "%");
}

} catch (Exception e) {
Expand Down
Loading

0 comments on commit 38c4a7f

Please sign in to comment.