Skip to content

Commit

Permalink
Merge pull request #714 from aionnetwork/stats-update
Browse files Browse the repository at this point in the history
Stats enhancements
  • Loading branch information
AlexandraRoatis authored Nov 21, 2018
2 parents 99844c4 + 03007e4 commit 0ae32fb
Show file tree
Hide file tree
Showing 12 changed files with 538 additions and 199 deletions.
70 changes: 70 additions & 0 deletions modAionImpl/src/org/aion/zero/impl/sync/RequestCounter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*
* Copyright (c) 2017-2018 Aion foundation.
*
* This file is part of the aion network project.
*
* The aion network project is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or any later version.
*
* The aion network project is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the aion network project source files.
* If not, see <https://www.gnu.org/licenses/>.
*
* Contributors:
* Aion foundation.
*/

package org.aion.zero.impl.sync;

/**
* Used for tracking different types of requests made to peers.
*
* @author Alexandra Roatis
*/
public class RequestCounter {

private long status = 0;
private long headers = 0;
private long bodies = 0;
private long total = 0;

public RequestCounter() {}

public long getStatus() {
return status;
}

public long getHeaders() {
return headers;
}

public long getBodies() {
return bodies;
}

public long getTotal() {
return total;
}

public void incStatus() {
this.status++;
this.total++;
}

public void incHeaders() {
this.headers++;
this.total++;
}

public void incBodies() {
this.bodies++;
this.total++;
}
}
35 changes: 35 additions & 0 deletions modAionImpl/src/org/aion/zero/impl/sync/RequestType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2017-2018 Aion foundation.
*
* This file is part of the aion network project.
*
* The aion network project is free software: you can redistribute it
* and/or modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3 of
* the License, or any later version.
*
* The aion network project is distributed in the hope that it will
* be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with the aion network project source files.
* If not, see <https://www.gnu.org/licenses/>.
*
* Contributors:
* Aion foundation.
*/

package org.aion.zero.impl.sync;

/**
* Used for tracking different types of requests made to peers.
*
* @author Alexandra Roatis
*/
public enum RequestType {
STATUS,
HEADERS,
BODIES
}
2 changes: 2 additions & 0 deletions modAionImpl/src/org/aion/zero/impl/sync/SyncMgr.java
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public void init(
downloadedHeaders,
headersWithBodiesRequested,
peerStates,
stats,
log),
"sync-gb");
syncGb.start();
Expand Down Expand Up @@ -249,6 +250,7 @@ private void getHeaders(BigInteger _selfTd) {
chain.getBestBlock().getNumber(),
_selfTd,
peerStates,
stats,
log));
queueFull.set(false);
}
Expand Down
Loading

0 comments on commit 0ae32fb

Please sign in to comment.