Beispiel #1
0
def create_trace(topof, num_nodes, num_locs=N_LOCATIONS, num_objs=N_OBJECTS,
                 conflict=CONFLICT, Am=ACCESS_MU, As=ACCESS_SIGMA,
                 ts=TIMESTEPS):

    # Modify parameters
    # Disable logging during trace generation
    logger = logging.getLogger('cloudscope.simulation')
    logger.disabled = True

    # Update settings arguments
    settings.simulation.conflict_prob = conflict
    settings.simulation.access_mean   = Am
    settings.simulation.access_stddev = As

    # Simulation arguments
    kwargs = {
        'users': num_nodes,
        'objects': num_objs,
        'max_sim_time': ts,
        'trace': None,
    }

    # Create simulation
    simulation = ConsistencySimulation.load(topof, **kwargs)
    simulation.trace = None
    simulation.script()
    workload = simulation.workload

    # Create the traces writer and write the traces to disk
    writer = TracesWriter(workload, ts)
    outpath = os.path.join(TRACES, TRACENAME.format(num_nodes, num_locs))

    with open(outpath, 'w') as f:
        counts = writer.write(f)
Beispiel #2
0
    def handle(self, args):
        """
        Uses built in workloads and the TracesWriter to generate a trace file.
        """
        # Disable logging during trace generation
        logger = logging.getLogger('cloudscope.simulation')
        logger.disabled = True

        # Update settings arguments
        settings.simulation.conflict_prob = args.conflict
        settings.simulation.access_mean = args.access_mean
        settings.simulation.access_stddev = args.access_stddev

        # Simulation arguments
        kwargs = {
            'users': args.users,
            'objects': args.objects,
            'max_sim_time': args.timesteps,
            'trace': None,
        }

        # Create simulation
        simulation = ConsistencySimulation.load(args.data[0], **kwargs)
        simulation.trace = None

        # Create or select the correct simulation
        if args.best_case or args.tiered:
            workload = BestCaseAllocation(
                simulation,
                args.objects,
                selection='random',
            )
            workload.allocate_many(args.users)

        elif args.ping_pong:
            factory = CharacterSequence(upper=True)
            objects = [factory.next() for _ in range(args.objects)]
            workload = PingPongWorkload(
                simulation,
                simulation.replicas[:args.users],
                objects=objects,
            )

        else:
            simulation.script()
            workload = simulation.workload

        # Create the traces writer and write the traces to disk
        writer = TracesWriter(workload, args.timesteps)
        counts = writer.write(args.output)

        return (
            "traced {rows:,} accesses on {devices:,} devices over {timesteps:,} timesteps ({realtime})\n"
            "object space contains {objects:,} object names:\n"
            "  {mean_objects_per_device:,} average objects per device | "
            "{mean_devices_per_object:,} average devices per object\n"
            "  {mean_accesses_per_device:,} average accesses per device | "
            "{mean_accesses_per_object:,} average accesses per object\n"
            "wrote the trace file to {0}").format(args.output.name, **counts)
Beispiel #3
0
    def handle(self, args):
        """
        Uses built in workloads and the TracesWriter to generate a trace file.
        """
        # Disable logging during trace generation
        logger = logging.getLogger('cloudscope.simulation')
        logger.disabled = True

        # Update settings arguments
        settings.simulation.conflict_prob = args.conflict
        settings.simulation.access_mean   = args.access_mean
        settings.simulation.access_stddev = args.access_stddev

        # Simulation arguments
        kwargs = {
            'users': args.users,
            'objects': args.objects,
            'max_sim_time': args.timesteps,
            'trace': None,
        }

        # Create simulation
        simulation = ConsistencySimulation.load(args.data[0], **kwargs)
        simulation.trace = None

        # Create or select the correct simulation
        if args.best_case or args.tiered:
            workload = BestCaseAllocation(
                simulation, args.objects, selection='random',
            )
            workload.allocate_many(args.users)

        elif args.ping_pong:
            factory = CharacterSequence(upper=True)
            objects = [factory.next() for _ in range(args.objects)]
            workload = PingPongWorkload(
                simulation, simulation.replicas[:args.users], objects=objects,
            )

        else:
            simulation.script()
            workload = simulation.workload

        # Create the traces writer and write the traces to disk
        writer = TracesWriter(workload, args.timesteps)
        counts = writer.write(args.output)

        return (
            "traced {rows:,} accesses on {devices:,} devices over {timesteps:,} timesteps ({realtime})\n"
            "object space contains {objects:,} object names:\n"
            "  {mean_objects_per_device:,} average objects per device | "
            "{mean_devices_per_object:,} average devices per object\n"
            "  {mean_accesses_per_device:,} average accesses per device | "
            "{mean_accesses_per_object:,} average accesses per object\n"
            "wrote the trace file to {0}"
        ).format(args.output.name, **counts)