X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/24dbcb1a8071fe684d776063f04b314d92094e8d..23da67335f942457b0d8b1f10e9849eba0eee9f7:/contrib/psg/src/example/bittorrent/BTObserver.java diff --git a/contrib/psg/src/example/bittorrent/BTObserver.java b/contrib/psg/src/example/bittorrent/BTObserver.java deleted file mode 100644 index ddd38dab2b..0000000000 --- a/contrib/psg/src/example/bittorrent/BTObserver.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * Copyright (c) 2007-2008 Fabrizio Frioli, Michele Pedrolli - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 2 as - * published by the Free Software Foundation. - * - * This program 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 Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - * - * -- - * - * Please send your questions/suggestions to: - * {fabrizio.frioli, michele.pedrolli} at studenti dot unitn dot it - * - */ - -package example.bittorrent; - -import peersim.config.*; -import peersim.core.*; -import peersim.util.*; - -/** - * This {@link Control} provides a way to keep track of some - * parameters of the BitTorrent network. - */ - public class BTObserver implements Control { - - /** - * The protocol to operate on. - * @config - */ - private static final String PAR_PROT="protocol"; - - /** - * Protocol identifier, obtained from config property - */ - private final int pid; - - /** - * The basic constructor that reads the configuration file. - * @param prefix the configuration prefix for this class - */ - public BTObserver(String prefix) { - pid = Configuration.getPid(prefix + "." + PAR_PROT); - } - - /** - * Prints information about the BitTorrent network - * and the number of leechers and seeders. - * Please refer to the code comments for more details. - * @return always false - */ - public boolean execute() { - IncrementalFreq nodeStatusStats = new IncrementalFreq(); - IncrementalStats neighborStats = new IncrementalStats(); - - int numberOfNodes = Network.size(); - int numberOfCompletedPieces = 0; - - // cycles from 1, since the node 0 is the tracker - for (int i=1; i