Package

Source Code of TesteMedidas

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

import Comunicacao.ThreadReceptoraTinyOS;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
*
* @author Cecilia
*/
public class TesteMedidas implements PropertyChangeListener{
   
    private ThreadReceptoraTinyOS threadReceptora;
    long inicio;
    long fim;
    long pacotes = 0;
   
    public void testar(){
        java.io.File file = new java.io.File("FlexMeterLog\\teste " + System.currentTimeMillis() + ".txt");
        threadReceptora = new ThreadReceptoraTinyOS(/*infoSessao,*/ this);
        threadReceptora.addPropertyChangeListener( this );
        inicio = Calendar.getInstance().getTimeInMillis();
        threadReceptora.run(file);
       
        while (true){
            try {
                Thread.sleep(1000);
                fim = Calendar.getInstance().getTimeInMillis();
                System.out.println(pacotes*1000/(fim-inicio));
            } catch (InterruptedException ex) {
                Logger.getLogger(TesteMedidas.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
   
    public void propertyChange(PropertyChangeEvent evt) {
        pacotes++;
    }
   
    public static void main(String[] args){
        TesteMedidas me = new TesteMedidas();
       
        me.testar();
    }
   
}
TOP

Related Classes of TesteMedidas

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.