Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 | 42x 42x 42x 135x 135x 135x 135x 117x 117x 117x 117x 4x 4x 4x 4x 42x 135x 135x 135x 246x 135x 135x 123x 135x 125x | import { BehaviorSubject } from 'rxjs';
import { CLEAN_FN_STATS, ProviderFnStats, ProviderTracker } from './ProviderTracker';
import { WalletNetworkInfoProvider } from '../../types';
export class WalletNetworkInfoProviderStats {
readonly eraSummaries$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
readonly protocolParameters$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
readonly genesisParameters$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
readonly ledgerTip$ = new BehaviorSubject<ProviderFnStats>(CLEAN_FN_STATS);
shutdown() {
this.eraSummaries$.complete();
this.protocolParameters$.complete();
this.genesisParameters$.complete();
this.ledgerTip$.complete();
}
reset() {
this.eraSummaries$.next(CLEAN_FN_STATS);
this.protocolParameters$.next(CLEAN_FN_STATS);
this.genesisParameters$.next(CLEAN_FN_STATS);
this.ledgerTip$.next(CLEAN_FN_STATS);
}
}
/** Wraps a WalletNetworkInfoProvider, tracking # of calls of each function */
export class TrackedWalletNetworkInfoProvider extends ProviderTracker implements WalletNetworkInfoProvider {
readonly stats = new WalletNetworkInfoProviderStats();
readonly eraSummaries: WalletNetworkInfoProvider['eraSummaries'];
readonly ledgerTip: WalletNetworkInfoProvider['ledgerTip'];
readonly protocolParameters: WalletNetworkInfoProvider['protocolParameters'];
readonly genesisParameters: WalletNetworkInfoProvider['genesisParameters'];
constructor(networkInfoProvider: WalletNetworkInfoProvider) {
super();
networkInfoProvider = networkInfoProvider;
this.eraSummaries = () => this.trackedCall(() => networkInfoProvider.eraSummaries(), this.stats.eraSummaries$);
this.ledgerTip = () => this.trackedCall(() => networkInfoProvider.ledgerTip(), this.stats.ledgerTip$);
this.protocolParameters = () =>
this.trackedCall(() => networkInfoProvider.protocolParameters(), this.stats.protocolParameters$);
this.genesisParameters = () =>
this.trackedCall(() => networkInfoProvider.genesisParameters(), this.stats.genesisParameters$);
}
}
|