Skip to content

Commit

Permalink
Merge pull request #836 from aionnetwork/stats-lru
Browse files Browse the repository at this point in the history
Minor enhancements to stats and kernel use
  • Loading branch information
AlexandraRoatis committed Feb 22, 2019
2 parents 6b30a2a + ebc3c2e commit 62aa0b4
Show file tree
Hide file tree
Showing 10 changed files with 204 additions and 149 deletions.
2 changes: 1 addition & 1 deletion config/mainnet/config.xml
Expand Up @@ -66,7 +66,7 @@
<!--Sets the physical location on disk where data will be stored.-->
<path>database</path>
<!--Boolean value. Enable/disable database integrity check run at startup.-->
<check_integrity>true</check_integrity>
<check_integrity>false</check_integrity>
<!--Data pruning behavior for the state database. Options: FULL, TOP, SPREAD.-->
<!--FULL: the state is not pruned-->
<!--TOP: the state is kept only for the top K blocks; limits sync to branching only within the stored blocks-->
Expand Down
2 changes: 1 addition & 1 deletion config/mastery/config.xml
Expand Up @@ -62,7 +62,7 @@
<!--Sets the physical location on disk where data will be stored.-->
<path>database</path>
<!--Boolean value. Enable/disable database integrity check run at startup.-->
<check_integrity>true</check_integrity>
<check_integrity>false</check_integrity>
<!--Data pruning behavior for the state database. Options: FULL, TOP, SPREAD.-->
<!--FULL: the state is not pruned-->
<!--TOP: the state is kept only for the top K blocks; limits sync to branching only within the stored blocks-->
Expand Down
3 changes: 2 additions & 1 deletion modAionImpl/src/org/aion/zero/impl/AionHub.java
Expand Up @@ -171,7 +171,8 @@ private void initializeHub(
cfg.getSync().getCompactEnabled()
? cfg.getSync().getSlowImportTime()
: 0, // set to 0 when disabled
cfg.getSync().getCompactFrequency());
cfg.getSync().getCompactFrequency(),
cfg.getNet().getP2p().getMaxActiveNodes());

ChainConfiguration chainConfig = new ChainConfiguration();
this.propHandler =
Expand Down
14 changes: 13 additions & 1 deletion modAionImpl/src/org/aion/zero/impl/sync/RequestCounter.java
Expand Up @@ -12,7 +12,19 @@ public class RequestCounter {
private long bodies = 0;
private long total = 0;

public RequestCounter() {}
public RequestCounter(RequestType type) {
switch (type) {
case STATUS:
incStatus();
break;
case HEADERS:
incHeaders();
break;
case BODIES:
incBodies();
break;
}
}

public long getStatus() {
return status;
Expand Down
5 changes: 3 additions & 2 deletions modAionImpl/src/org/aion/zero/impl/sync/SyncMgr.java
Expand Up @@ -168,7 +168,8 @@ public void init(
final boolean _showStatus,
final Set<StatsType> showStatistics,
final int _slowImportTime,
final int _compactFrequency) {
final int _compactFrequency,
final int maxActivePeers) {
p2pMgr = _p2pMgr;
chain = _chain;
evtMgr = _evtMgr;
Expand All @@ -178,7 +179,7 @@ public void init(
blockHeaderValidator = new ChainConfiguration().createBlockHeaderValidator();

long selfBest = chain.getBestBlock().getNumber();
stats = new SyncStats(selfBest, _showStatus, showStatistics);
stats = new SyncStats(selfBest, _showStatus, showStatistics, maxActivePeers);

syncGb =
new Thread(
Expand Down

0 comments on commit 62aa0b4

Please sign in to comment.