[Tinyos-contrib-commits] CVS: tinyos-1.x/contrib/umass/apps/TransTest Makefile, NONE, 1.1 StressTest.nc, NONE, 1.1 StressTestC.nc, NONE, 1.1 sizes.h, NONE, 1.1

Gaurav gmathur at users.sourceforge.net
Sat Dec 9 13:05:51 PST 2006


Update of /cvsroot/tinyos/tinyos-1.x/contrib/umass/apps/TransTest
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv17795/apps/TransTest

Added Files:
	Makefile StressTest.nc StressTestC.nc sizes.h 
Log Message:
Added contrib/umass containing Capsule -- a storage system for sensors

--- NEW FILE: Makefile ---
MSG_SIZE=128
COMPONENT=StressTest
PFLAGS=-I%T/lib/Util -g
include ../Makerules

--- NEW FILE: StressTest.nc ---
/*
 * Test Compaction
 */
includes common_header;
includes sizes;

configuration StressTest {
}

implementation {
    components Main, StressTestC, ChunkStorageC, FalC, ConsoleC,
               LedsC, StackC, HPLUARTC, QueueC, StreamC,
               IndexC, ArrayC, CheckpointC, RootDirectoryC, SysTimeC, CompactionAbsorbC;

    Main.StdControl -> StressTestC;
    Main.StdControl -> FalC;
    Main.StdControl -> ChunkStorageC;

    /* Wire the chunk storage system */
    ChunkStorageC.GenericFlash -> FalC.GenericFlash[unique("Fal")];
    ChunkStorageC.Leds -> LedsC;
    ChunkStorageC.Compaction -> CompactionAbsorbC;
    RootDirectoryC.GenericFlash -> FalC.GenericFlash[unique("Fal")];
    RootDirectoryC.Leds -> LedsC;
    RootDirectoryC.Console -> ConsoleC;
    RootDirectoryC.SysTime -> SysTimeC;

    /* Wire the data structures */
    StackC.ChunkStorage -> ChunkStorageC.ChunkStorage[1];
    StreamC.ChunkStorage -> ChunkStorageC.ChunkStorage[2];
    ArrayC.ChunkStorage -> ChunkStorageC.ChunkStorage[3];
    IndexC.ChunkStorage -> ChunkStorageC.ChunkStorage[4];
    StreamC.Stack -> StackC.Stack[1];
    IndexC.Array -> ArrayC.Array[0];
    StackC.Console -> ConsoleC;
    
    CheckpointC.ChunkStorage -> ChunkStorageC.ChunkStorage[5];
    CheckpointC.Stack -> StackC.Stack[0];
    CheckpointC.RootPtrAccess -> StackC.RootPtrAccess[0];
    CheckpointC.RootDirectory -> RootDirectoryC;
    CheckpointC.Serialize -> IndexC.Serialize[0];
    CheckpointC.Serialize -> StreamC.Serialize[0];

    StackC.Leds -> LedsC;
    StreamC.Leds -> LedsC;
    ArrayC.Leds -> LedsC;
    IndexC.Leds -> LedsC;
    CheckpointC.Leds -> LedsC;
    
    /* Debugging */
    StressTestC.Console -> ConsoleC;
    StreamC.Console -> ConsoleC;
    StackC.Console -> ConsoleC;
    IndexC.Console -> ConsoleC;
    ArrayC.Console -> ConsoleC;
    IndexC.Console -> ConsoleC;
    ConsoleC.HPLUART -> HPLUARTC;
    ChunkStorageC.Console -> ConsoleC;
    CheckpointC.Console -> ConsoleC;

    /* Testing */
    //StressTestC.ChunkStorage -> ChunkStorageC.ChunkStorage[0];
    StressTestC.Leds -> LedsC;
    //StressTestC.Stack -> StackC.Stack[0];
    StressTestC.GenericFlash -> FalC.GenericFlash[unique("Fal")];
    //StressTestC.StreamIndex -> StreamIndexC.StreamIndex[0];
    //StressTestC.Index -> IndexC.Index[0];
    //StressTestC.Stream -> StreamC.Stream[1];
    StressTestC.Checkpoint -> CheckpointC.Checkpoint;
}

--- NEW FILE: StressTestC.nc ---
/*
 * Measuring the performance of the data structures
 */
includes chunk_header;
includes sizes;

module StressTestC {
    provides interface StdControl;
    
    uses {
        interface Leds;
        interface Console;
        interface GenericFlash;
        interface Checkpoint;
    }
}

implementation {
    bool ecc, busy;
    uint16_t pages, current;
    flashptr_t someptr;
    datalen_t len;


    task void format();
    task void check_read();
    task void check_write();

    task void check_trans_start()
    {
        call Leds.greenToggle();
        call Leds.greenToggle();

        if (SUCCESS != call Checkpoint.checkpoint())
        {
            call Leds.redOn();
#ifdef Checkpoint_DEBUG
            call Console.string("Error starting..\n");
#endif
        }
    }

    task void check_trans_rollback()
    {
        call Leds.greenToggle();
        call Leds.greenToggle();

        if (SUCCESS != call Checkpoint.rollback())
        {
            call Leds.redOn();
#ifdef Checkpoint_DEBUG
            call Console.string("Error rolling back..\n");
#endif
        }
    }


    event void Checkpoint.rollbackDone(result_t res)
    {
        call Leds.greenToggle();
        call Leds.greenToggle();

        if (res == FAIL)
        {
            call Leds.redOn();
            call Console.string("Rollback call returned failure\n");
        }
        else 
        {
#ifdef Checkpoint_DEBUG
            call Console.string("Rollback success");
            call Console.string("\n");
            TOSH_uwait(3000);
#endif
            call Console.string("done\n");
        }

    }

    event void Checkpoint.checkpointDone(result_t res)
    {
        call Leds.greenToggle();
        call Leds.greenToggle();

        if (res == FAIL)
        {
            call Leds.redOn();
            call Console.string("Checkpoint call returned failure\n");
        }
        else 
        {
#ifdef Checkpoint_DEBUG
            call Console.string("Checkpoint success");
            call Console.string("\n");
            TOSH_uwait(3000);
#endif
            call Console.string("done\n");
        }
    }

    command result_t StdControl.init() 
    {
        busy = 0;
        current = pages = 0;

        call Console.init();

        call Leds.init();
        
        return SUCCESS;
    }

    command result_t StdControl.start() 
    {    
        pages = 192;

        post format();
        
        return SUCCESS;
    }
    
    command result_t StdControl.stop() 
    {
        return SUCCESS;
    }

    event void Console.input(char *s)
    {
    }

    task void format()
    {
        if (SUCCESS != call GenericFlash.erase(current))
        {
            call Console.string("ERROR ! erase call failed\n");
            call Leds.redOn();
        }

        current += 1;
    }

    event result_t GenericFlash.eraseDone(result_t r)
    {
        if (SUCCESS != r)
        {
            call Leds.redOn();
            call Console.string("ERROR ! erase call failure\n");
            return (FAIL);
        }
        else
        {
            if (current < pages)
            {
                post format();
            }
            else
            {
                call Console.string("Flash formatted... Ready");

                current = 0;
                //call Timer.start(TIMER_REPEAT, 5000);
                call Checkpoint.init(FALSE);
                post check_trans_start();
           }
        }

        return (SUCCESS);
    }
    
    event result_t GenericFlash.initDone(result_t r)
    {
        call Console.string("Init done\n");
        return (SUCCESS);
    }

    event result_t GenericFlash.writeDone(result_t r)
    {
        return (SUCCESS);
    }

    event result_t GenericFlash.readDone(result_t r)
    {
        return (SUCCESS);
    }

    event result_t GenericFlash.falReadDone(result_t r)
    {
        return (SUCCESS);
    }

}

--- NEW FILE: sizes.h ---
#ifndef SIZES_H
#define SIZES_H

/*
 * Debug messages
 */

//#define INDEX_DEBUG
//#define ARRAY_DEBUG
//#define CHUNK_DEBUG
//#define QUEUE_DEBUG
//#define STACK_DEBUG
//#define STREAM_DEBUG
//#define STREAM_INDEX_DEBUG
//#define TRANSACTION_DEBUG
//#define ROOT_DIR_DEBUG
//#define COMPACT_DEBUG
#define COUNT 20
/* Length of the data (compaction expt) */
#define LEN 32


/*
 * TODO
 * The following defines the number of instances of each of these storage 
 * objects being used in the application.
 * The values for these should ideally be set automatically by the compiler
 */

#define NUM_STACKS 2

#define NUM_STREAMS 2

#define NUM_QUEUES 1

#define NUM_INDEXES 1

#define NUM_ARRAYS 1

#define NUM_STREAM_INDEXES 1

#define NUM_CHECKPOINTS 1 

/*
 * This indicates the number of elements in level 1 of the index
 */
#define ARRAY_ELEMENTS_PER_CHUNK 10

/*
 * This indicates the number of index elements in level 2 of the index
 */
#define INDEX_ELEMENTS_PER_CHUNK 10




#endif



More information about the Tinyos-contrib-commits mailing list