Exemplo n.º 1
0
    /// Where the actual measurement is performed
    void run()
    {

        // Check with the result memory whether we already have
        // results for this configuration
        gauge::config_set cs = get_current_configuration();

        // We switch any systematic operations off so we code
        // symbols from the beginning
        if(kodo::has_systematic_encoder<Encoder>::value)
            kodo::set_systematic_off(m_encoder);

        RUN{

            while( !m_decoder->is_complete() )
            {
                // Encode a packet into the payload buffer
                m_encoder->encode( &m_payload_buffer[0] );

                if(rand() % 2)
                {
                    // Pass that packet to the decoder
                    m_decoder->decode( &m_payload_buffer[0] );
                }
            }
        }
    }
Exemplo n.º 2
0
    double measurement()
    {
        // Get the time spent per iteration
        double time = gauge::time_benchmark::measurement();

        gauge::config_set cs = get_current_configuration();
        std::string type = cs.get_value<std::string>("type");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");

        // The number of bytes {en|de}coded
        uint64_t total_bytes = 0;

        if (type == "decoder")
        {
            total_bytes = m_decoded_symbols * symbol_size;
        }
        else if (type == "encoder")
        {
            total_bytes = m_encoded_symbols * symbol_size;
        }
        else
        {
            assert(0);
        }

        // The bytes per iteration
        uint64_t bytes =
            total_bytes / gauge::time_benchmark::iteration_count();

        return bytes / time; // MB/s for each iteration
    }
Exemplo n.º 3
0
    bool accept_measurement()
    {
        gauge::config_set cs = get_current_configuration();

        std::string type = cs.get_value<std::string>("type");

        if (type == "decoder")
        {
            // If we are benchmarking a decoder we only accept
            // the measurement if the decoding was successful
            if (!m_decoder->is_complete())
            {
                // We did not generate enough payloads to decode successfully,
                // so we will generate more payloads for next run
                ++m_factor;

                return false;
            }

            // At this point, the output data should be equal to the input data
            assert(m_data_out == m_data_in);
        }

        return gauge::time_benchmark::accept_measurement();
    }
    /// Prepares the data structures between each run
    void setup()
    {
        gauge::config_set cs = get_current_configuration();

        uint32_t size = cs.get_value<uint32_t>("size");
        uint32_t vectors = cs.get_value<uint32_t>("vectors");

        // Prepare the continuous data blocks
        m_data_one.resize(vectors * size);
        m_data_two.resize(vectors * size);

        for (uint32_t i = 0; i < size; ++i)
        {
            m_data_one[i] = rand() % 256;
            m_data_two[i] = rand() % 256;
        }

        // Prepare the symbol pointers
        m_symbols_one.resize(vectors);
        m_symbols_two.resize(vectors);

        for (uint32_t i = 0; i < vectors; ++i)
        {
            m_symbols_one[i] = &m_data_one[i * size];
            m_symbols_two[i] = &m_data_two[i * size];
        }

        gf_gen_rs_matrix(a, vectors, vectors);
    }
Exemplo n.º 5
0
    /// Run the decoder
    void run_decode()
    {
        // Encode some data
        encode_payloads();

        gauge::config_set cs = get_current_configuration();

        uint32_t symbols = cs.get_value<uint32_t>("symbols");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");

        m_decoder_factory->set_symbols(symbols);
        m_decoder_factory->set_symbol_size(symbol_size);

        // Zero the data buffer for the decoder
        std::fill_n(m_data_out.begin(), m_data_out.size(), 0);

        // The clock is running
        RUN
        {
            // We have to make sure the decoder is in a "clean" state
            // i.e. no symbols already decoded.
            m_decoder->initialize(*m_decoder_factory);

            m_decoder->set_symbols(sak::storage(m_data_out));

            // Decode the payloads
            decode_payloads();
        }
    }
Exemplo n.º 6
0
    /// Prepares the measurement for every run
    void setup()
    {
        gauge::config_set cs = get_current_configuration();

        uint32_t symbols = cs.get_value<uint32_t>("symbols");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");

        m_decoder_factory = std::make_shared<decoder_factory>(
            symbols, symbol_size);

        m_encoder_factory = std::make_shared<encoder_factory>(
            symbols, symbol_size);

        m_decoder_factory->set_symbols(symbols);
        m_decoder_factory->set_symbol_size(symbol_size);

        m_encoder_factory->set_symbols(symbols);
        m_encoder_factory->set_symbol_size(symbol_size);

        m_encoder = m_encoder_factory->build();
        m_decoder = m_decoder_factory->build();

        m_payload_buffer.resize(m_encoder->payload_size(), 0);
        m_encoded_data.resize(m_encoder->block_size(), 'x');

        m_encoder->set_symbols(sak::storage(m_encoded_data));
    }
Exemplo n.º 7
0
    void setup()
    {
        gauge::config_set cs = get_current_configuration();

        uint32_t symbols = cs.get_value<uint32_t>("symbols");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");

        /// @todo Research the cause of this
        // Make the factories fit perfectly otherwise there seems to
        // be problems with memory access i.e. when using a factory
        // with max symbols 1024 with a symbols 16
        m_decoder_factory = std::make_shared<decoder_factory>(
            symbols, symbol_size);

        m_encoder_factory = std::make_shared<encoder_factory>(
            symbols, symbol_size);

        m_decoder_factory->set_symbols(symbols);
        m_decoder_factory->set_symbol_size(symbol_size);

        m_encoder_factory->set_symbols(symbols);
        m_encoder_factory->set_symbol_size(symbol_size);

        m_encoder = m_encoder_factory->build();
        m_decoder = m_decoder_factory->build();

        // Prepare the data buffers
        m_data_in.resize(m_encoder->block_size());
        m_data_out.resize(m_encoder->block_size());

        std::generate_n(m_data_in.begin(), m_data_in.size(), rand);

        m_encoder->set_symbols(sak::storage(m_data_in));

        // This step is not needed for deep storage decoders, but also
        // does not hurt :) For shallow decoders it will provide the
        // memory that we will decode into, whereas a deep storage
        // decoder already has its own memory (in this case the deep
        // storage decoder will just gets its internal memory
        // initialized by m_data_out)
        m_decoder->set_symbols(sak::storage(m_data_out));

        // Create the payload buffer
        m_temp_payload.resize(m_decoder->payload_size());

        // Prepare storage to the encoded payloads
        uint32_t payload_count = symbols * m_factor;
        assert(payload_count > 0);

        m_payloads.resize(payload_count);
        for (auto& payload : m_payloads)
        {
            payload.resize(m_encoder->payload_size());
        }
    }
Exemplo n.º 8
0
    void setup()
    {
        gauge::config_set cs = get_current_configuration();

        uint32_t symbols = cs.get_value<uint32_t>("symbols");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");
        uint32_t erased_symbols = cs.get_value<uint32_t>("erased_symbols");

        // Make the factories fit perfectly otherwise there seems to
        // be problems with memory access i.e. when using a factory
        // with max symbols 1024 with a symbols 16
        m_decoder_factory = std::make_shared<decoder_factory>(
            symbols, symbol_size);

        m_encoder_factory = std::make_shared<encoder_factory>(
            symbols, symbol_size);

        m_decoder_factory->set_symbols(symbols);
        m_decoder_factory->set_symbol_size(symbol_size);

        m_encoder_factory->set_symbols(symbols);
        m_encoder_factory->set_symbol_size(symbol_size);

        m_encoder = m_encoder_factory->build();
        m_decoder = m_decoder_factory->build();

        // Prepare the data buffers
        m_data_in.resize(m_encoder->block_size());
        m_data_out.resize(m_encoder->block_size());
        std::fill_n(m_data_out.begin(), m_data_out.size(), 0);

        for (uint8_t &e : m_data_in)
        {
            e = rand() % 256;
        }

        m_encoder->set_const_symbols(storage::storage(m_data_in));

        m_decoder->set_mutable_symbols(storage::storage(m_data_out));

        // Prepare storage for the encoded payloads
        uint32_t payload_count = erased_symbols * m_factor;
        assert(payload_count > 0);

        // Allocate contiguous payload buffer and store payload pointers
        uint32_t payload_size = m_encoder->payload_size();
        m_payload_buffer.resize(payload_count * payload_size);
        m_payloads.resize(payload_count);

        for (uint32_t i = 0; i < payload_count; ++i)
        {
            m_payloads[i] = &m_payload_buffer[i * payload_size];
        }
    }
Exemplo n.º 9
0
    void setup()
    {
        gauge::config_set cs = get_current_configuration();

        uint32_t symbols = cs.get_value<uint32_t>("symbols");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");
        bool systematic = cs.get_value<bool>("systematic");

        m_decoder_factory->set_symbols(symbols);
        m_decoder_factory->set_symbol_size(symbol_size);

        m_encoder_factory->set_symbols(symbols);
        m_encoder_factory->set_symbol_size(symbol_size);

        m_encoder = m_encoder_factory->build();
        m_decoder = m_decoder_factory->build();

        // We switch any systematic operations off so we code
        // symbols from the beginning
        if(kodo::has_systematic_encoder<Encoder>::value)
        {
            if(systematic)
            {
                kodo::set_systematic_on(m_encoder);
            }
            else
            {
                kodo::set_systematic_off(m_encoder);
            }
        }


        // Prepare the data to be encoded
        m_encoded_data.resize(m_encoder->block_size());

        for(uint8_t &e : m_encoded_data)
        {
            e = rand() % 256;
        }

        m_encoder->set_symbols(sak::storage(m_encoded_data));

        m_symbols_used = 0;
        m_rank_used.resize(symbols);
        std::fill(m_rank_used.begin(), m_rank_used.end(), 0);

        double erasure = cs.get_value<double>("erasure");
        m_distribution = boost::random::bernoulli_distribution<>(erasure);
    }
Exemplo n.º 10
0
    double measurement()
    {
        // Get the time spent per iteration
        double time = gauge::time_benchmark::measurement();

        gauge::config_set cs = get_current_configuration();

        uint32_t size = cs.get_value<uint32_t>("size");
        uint32_t vectors = cs.get_value<uint32_t>("vectors");

        // The number of bytes processed per iteration
        uint64_t bytes = size * vectors;

        return bytes / time; // MB/s for each iteration
    }
Exemplo n.º 11
0
void
release_configure(char *gdb_version, struct supported_gdb_version *sp)
{
	FILE *fp1, *fp2;
	int found;
	char buf[512];
	char gdb_files[MAXSTRLEN];

	get_current_configuration(sp);

	sprintf(buf, "%s/gdb", gdb_version);
	if (!file_exists(buf)) {
		fprintf(stderr, "make release: no such directory: %s\n", buf);
		exit(1);
	}
	sprintf(gdb_files, "GDB_%s_FILES", 
		&gdb_version[strlen("gdb-")]);

	makefile_setup(&fp1, &fp2);

	found = 0;
	while (fgets(buf, 512, fp1)) {
		if (strncmp(buf, gdb_files, strlen(gdb_files)) == 0)
			found++;
		if (strncmp(buf, "GDB_FILES=", strlen("GDB_FILES=")) == 0)
			fprintf(fp2, "GDB_FILES=${%s}\n", gdb_files);
		else if (strncmp(buf, "VERSION=", strlen("VERSION=")) == 0)
                        fprintf(fp2, "VERSION=%s\n", 
				target_data.release);
		else if (strncmp(buf, "GDB_PATCH_FILES=", strlen("GDB_PATCH_FILES=")) == 0)
			fprintf(fp2, "%s\n", sp->GDB_PATCH_FILES);
		else if (strncmp(buf, "GPL_FILES=", strlen("GPL_FILES=")) == 0)
			fprintf(fp2, "GPL_FILES=%s\n", strcmp(sp->GPL, "GPLv2") == 0 ? 
				"COPYING" : "COPYING3");
		else
			fprintf(fp2, "%s", buf);

	}

        if (!found) {
                fprintf(stderr, "make release: cannot find %s\n", gdb_files);
                exit(1);
        }

	makefile_create(&fp1, &fp2);
}
Exemplo n.º 12
0
    void run_benchmark()
    {
        gauge::config_set cs = get_current_configuration();
        uint32_t size = cs.get_value<uint32_t>("size");
        uint32_t vectors = cs.get_value<uint32_t>("vectors");

        RUN
        {
            // Make parity vects
            ec_init_tables(vectors, vectors, &a[vectors * vectors], g_tbls);

            for (uint32_t i = 0; i < vectors; ++i)
            {
                gf_vect_dot_prod(size, vectors, g_tbls,
                                 m_symbols_two.data(), m_symbols_one[i]);
            }
        }
    }
Exemplo n.º 13
0
    void run_benchmark()
    {
        gauge::config_set cs = get_current_configuration();

        std::string type = cs.get_value<std::string>("type");

        if (type == "encoder")
        {
            run_encode();
        }
        else if (type == "decoder")
        {
            run_decode();
        }
        else
        {
            assert(0);
        }
    }
Exemplo n.º 14
0
    /// Stops a measurement and saves the counter
    void stop()
    {
        gauge::config_set cs = get_current_configuration();

        std::string type = cs.get_value<std::string>("type");

        if(type == "encoder")
        {
            m_counter = m_encoder->get_operations_counter();
        }
        else if(type == "decoder")
        {
            m_counter = m_decoder->get_operations_counter();
        }
        else
        {
            assert(0);
        }
    }
Exemplo n.º 15
0
    /// Run the encoder
    void run_encode()
    {
        gauge::config_set cs = get_current_configuration();

        uint32_t symbols = cs.get_value<uint32_t>("symbols");
        uint32_t symbol_size = cs.get_value<uint32_t>("symbol_size");

        m_encoder_factory->set_symbols(symbols);
        m_encoder_factory->set_symbol_size(symbol_size);

        // The clock is running
        RUN
        {
            // We have to make sure the encoder is in a "clean" state
            m_encoder->initialize(*m_encoder_factory);

            encode_payloads();
        }

    }
Exemplo n.º 16
0
void
gdb_configure(struct supported_gdb_version *sp)
{
	FILE *fp1, *fp2;
	char buf[512];

	get_current_configuration(sp);

	makefile_setup(&fp1, &fp2);

	while (fgets(buf, 512, fp1)) {
		if (strncmp(buf, "GDB=", strlen("GDB=")) == 0)
			fprintf(fp2, "%s\n", sp->GDB);
		else
			fprintf(fp2, "%s", buf);

	}

	makefile_create(&fp1, &fp2);
}
Exemplo n.º 17
0
    void store_run(tables::table& results)
    {
        if (!results.has_column("goodput"))
            results.add_column("goodput");

        results.set_value("goodput", measurement());

        if (std::is_same<Feature, relaxed>::value)
        {
            gauge::config_set cs = get_current_configuration();
            std::string type = cs.get_value<std::string>("type");

            if (type == "decoder")
            {
                if (!results.has_column("extra_symbols"))
                    results.add_column("extra_symbols");

                uint32_t erased_symbols =
                    cs.get_value<uint32_t>("erased_symbols");
                uint32_t extra_symbols = m_processed_symbols - erased_symbols;
                results.set_value("extra_symbols", extra_symbols);
            }
        }
    }
Exemplo n.º 18
0
void
make_spec_file(struct supported_gdb_version *sp)
{
	char *Version, *Release;
	char buf[512];

	get_current_configuration(sp);

	Release = strstr(target_data.release, "-");
	if (!Release) {
		Version = target_data.release;
		Release = "0";		
	} else {
		fprintf(stderr, 
		    "crash.spec: obsolete src.rpm build manner -- no dashes allowed: %s\n",
			target_data.release);
		return;
	}

	printf("#\n");
	printf("# crash core analysis suite\n");
	printf("#\n");
	printf("Summary: crash utility for live systems; netdump, diskdump, kdump, LKCD or mcore dumpfiles\n");
	printf("Name: %s\n", lower_case(target_data.program, buf));
	printf("Version: %s\n", Version);
	printf("Release: %s\n", Release);
	printf("License: %s\n", sp->GPL);
	printf("Group: Development/Debuggers\n");
	printf("Source: %%{name}-%%{version}.tar.gz\n");
	printf("URL: http://people.redhat.com/anderson\n");
	printf("Distribution: Linux 2.2 or greater\n");
	printf("Vendor: Red Hat, Inc.\n");
	printf("Packager: Dave Anderson <*****@*****.**>\n");
	printf("ExclusiveOS: Linux\n");
	printf("ExclusiveArch: %%{ix86} alpha ia64 ppc ppc64 ppc64pseries ppc64iseries x86_64 s390 s390x arm aarch64 ppc64le mips mipsel\n");
	printf("Buildroot: %%{_tmppath}/%%{name}-root\n");
	printf("BuildRequires: ncurses-devel zlib-devel bison\n");
	printf("Requires: binutils\n");
	printf("# Patch0: crash-3.3-20.installfix.patch (patch example)\n");
	printf("\n");
	printf("%%description\n");
	printf("The core analysis suite is a self-contained tool that can be used to\n");
	printf("investigate either live systems, kernel core dumps created from the\n");
	printf("netdump, diskdump and kdump facilities from Red Hat Linux, the mcore kernel patch\n");
	printf("offered by Mission Critical Linux, or the LKCD kernel patch.\n");
	printf("\n");
	printf("%%package devel\n");
	printf("Requires: %%{name} = %%{version}, zlib-devel\n");
	printf("Summary: crash utility for live systems; netdump, diskdump, kdump, LKCD or mcore dumpfiles\n");
	printf("Group: Development/Debuggers\n");
	printf("\n");
	printf("%%description devel\n");
	printf("The core analysis suite is a self-contained tool that can be used to\n");
	printf("investigate either live systems, kernel core dumps created from the\n");
	printf("netdump, diskdump and kdump packages from Red Hat Linux, the mcore kernel patch\n");
	printf("offered by Mission Critical Linux, or the LKCD kernel patch.\n");
	printf("\n");
	printf("%%package extensions\n");
	printf("Summary: Additional commands for the crash dump analysis tool\n");
	printf("Group: Development/Debuggers\n");
	printf("\n");
	printf("%%description extensions\n");
	printf("The extensions package contains plugins that provide additional crash\n");
	printf("commands. The extensions can be loaded in crash via the \"extend\" command.\n");
	printf("\n");
	printf("The following extensions are provided:\n");
	printf("* eppic:  Provides C-like language for writing dump analysis scripts\n");
	printf("* dminfo: Device-mapper target analyzer\n");
	printf("* snap:   Takes a snapshot of live memory and creates a kdump dumpfile\n");
        printf("* trace:  Displays kernel tracing data and traced events that occurred prior to a panic.\n"); 
	printf("\n");
	printf("%%prep\n");
        printf("%%setup -n %%{name}-%%{version}\n"); 
	printf("# %%patch0 -p1 -b .install (patch example)\n");
	printf("\n");
	printf("%%build\n");
	printf("make RPMPKG=\"%%{version}\"\n");
	printf("# make RPMPKG=\"%%{version}-%%{release}\"\n");
	printf("make extensions\n");
     /*	printf("make crashd\n"); */
	printf("\n");
	printf("%%install\n");
	printf("rm -rf %%{buildroot}\n");
	printf("mkdir -p %%{buildroot}/usr/bin\n");
	printf("make DESTDIR=%%{buildroot} install\n");
	printf("mkdir -p %%{buildroot}%%{_mandir}/man8\n");
	printf("cp crash.8 %%{buildroot}%%{_mandir}/man8/crash.8\n");
	printf("mkdir -p %%{buildroot}%%{_includedir}/crash\n");
	printf("cp defs.h %%{buildroot}%%{_includedir}/crash\n");
	printf("mkdir -p %%{buildroot}%%{_libdir}/crash/extensions\n");
	printf("if [ -f extensions/eppic.so ]\n");
	printf("then\n");
	printf("cp extensions/eppic.so %%{buildroot}%%{_libdir}/crash/extensions\n");
	printf("fi\n");
	printf("cp extensions/dminfo.so %%{buildroot}%%{_libdir}/crash/extensions\n");
	printf("cp extensions/snap.so %%{buildroot}%%{_libdir}/crash/extensions\n");
	printf("cp extensions/trace.so %%{buildroot}%%{_libdir}/crash/extensions\n");
	printf("\n");
	printf("%%clean\n");
	printf("rm -rf %%{buildroot}\n");
	printf("\n");
	printf("%%files\n");
	printf("%%defattr(-,root,root)\n");
	printf("/usr/bin/crash\n");
	printf("%%{_mandir}/man8/crash.8*\n");
     /*	printf("/usr/bin/crashd\n"); */
	printf("%%doc README\n");
	printf("\n");
	printf("%%files devel\n");
	printf("%%defattr(-,root,root)\n");
	printf("%%{_includedir}/*\n");
	printf("\n");
	printf("%%files extensions\n");
	printf("%%defattr(-,root,root)\n");
	printf("%%{_libdir}/crash/extensions/*\n");
}
Exemplo n.º 19
0
void
build_configure(struct supported_gdb_version *sp)
{
	FILE *fp1, *fp2;
	char buf[512];
	char *target;
	char *target_CFLAGS;
	char *gdb_conf_flags;
	char *ldflags;
	char *cflags;

	get_current_configuration(sp);

	target = target_CFLAGS = NULL;

	gdb_conf_flags = GDB_TARGET_DEFAULT;
	switch (target_data.target)
	{
	case X86:
		target = TARGET_X86;
		if (target_data.host == X86_64) {
                        target_CFLAGS = TARGET_CFLAGS_X86_ON_X86_64;
			gdb_conf_flags = GDB_TARGET_X86_ON_X86_64;
		} else
			target_CFLAGS = TARGET_CFLAGS_X86;
		break;
	case ALPHA:
		target = TARGET_ALPHA;
		target_CFLAGS = TARGET_CFLAGS_ALPHA;
		break;
	case PPC:
		target = TARGET_PPC;
		if (target_data.host == PPC64) {
                        target_CFLAGS = TARGET_CFLAGS_PPC_ON_PPC64;
			gdb_conf_flags = GDB_TARGET_PPC_ON_PPC64;
		} else
			target_CFLAGS = TARGET_CFLAGS_PPC;
		break;
	case IA64:
		target = TARGET_IA64;
                target_CFLAGS = TARGET_CFLAGS_IA64;
		break;
	case S390:
		target = TARGET_S390;
		target_CFLAGS = TARGET_CFLAGS_S390;
		break;
	case S390X:
		target = TARGET_S390X;
		target_CFLAGS = TARGET_CFLAGS_S390X;
		break;
	case PPC64:
                target = TARGET_PPC64;
		if (target_data.host == X86_64) {
			target_CFLAGS = TARGET_CFLAGS_PPC64_ON_X86_64;
			gdb_conf_flags = GDB_TARGET_PPC64_ON_X86_64;
		} else
			target_CFLAGS = TARGET_CFLAGS_PPC64;
                break;
	case X86_64:
                target = TARGET_X86_64;
                target_CFLAGS = TARGET_CFLAGS_X86_64;
                break;
	case ARM:
                target = TARGET_ARM;
                if (target_data.host == X86) {
                        target_CFLAGS = TARGET_CFLAGS_ARM_ON_X86;
			gdb_conf_flags = GDB_TARGET_ARM_ON_X86;
                } else if (target_data.host == X86_64) {
                        target_CFLAGS = TARGET_CFLAGS_ARM_ON_X86_64;
			gdb_conf_flags = GDB_TARGET_ARM_ON_X86_64;
		} else
                        target_CFLAGS = TARGET_CFLAGS_ARM;
                break;
	case ARM64:
		target = TARGET_ARM64;
		if (target_data.host == X86_64) {
			target_CFLAGS = TARGET_CFLAGS_ARM64_ON_X86_64;
			gdb_conf_flags = GDB_TARGET_ARM64_ON_X86_64;
		} else
			target_CFLAGS = TARGET_CFLAGS_ARM64;
		break;
	case MIPS:
                target = TARGET_MIPS;
                if (target_data.host == X86) {
                        target_CFLAGS = TARGET_CFLAGS_MIPS_ON_X86;
			gdb_conf_flags = GDB_TARGET_MIPS_ON_X86;
                } else if (target_data.host == X86_64) {
                        target_CFLAGS = TARGET_CFLAGS_MIPS_ON_X86_64;
			gdb_conf_flags = GDB_TARGET_MIPS_ON_X86_64;
		} else
                        target_CFLAGS = TARGET_CFLAGS_MIPS;
                break;
	}

	ldflags = get_extra_flags("LDFLAGS.extra", NULL);
	cflags = get_extra_flags("CFLAGS.extra", NULL);
	gdb_conf_flags = get_extra_flags("GDBFLAGS.extra", gdb_conf_flags);

	makefile_setup(&fp1, &fp2);

	while (fgets(buf, 512, fp1)) {
		if (strncmp(buf, "TARGET=", strlen("TARGET=")) == 0)
			fprintf(fp2, "%s\n", target);
                else if (strncmp(buf, "TARGET_CFLAGS=",
			strlen("TARGET_CFLAGS=")) == 0)
                       	fprintf(fp2, "%s%s%s\n", target_CFLAGS,
				cflags ? " " : "", cflags ? cflags : "");
		else if (strncmp(buf, "GDB_CONF_FLAGS=",
			strlen("GDB_CONF_FLAGS=")) == 0)
			fprintf(fp2, "%s\n", gdb_conf_flags);
		else if (strncmp(buf, "GDB_FILES=",strlen("GDB_FILES=")) == 0)
			fprintf(fp2, "%s\n", sp->GDB_FILES);
		else if (strncmp(buf, "GDB_OFILES=",strlen("GDB_OFILES=")) == 0)
                        fprintf(fp2, "%s\n", sp->GDB_OFILES);
		else if (strncmp(buf, "GDB_PATCH_FILES=",strlen("GDB_PATCH_FILES=")) == 0)
                        fprintf(fp2, "%s\n", sp->GDB_PATCH_FILES);
		else if (strncmp(buf, "GDB_FLAGS=",strlen("GDB_FLAGS=")) == 0)
                        fprintf(fp2, "%s\n", sp->GDB_FLAGS);
		else if (strncmp(buf, "GPL_FILES=", strlen("GPL_FILES=")) == 0)
			fprintf(fp2, "GPL_FILES=%s\n", strcmp(sp->GPL, "GPLv2") == 0 ? 
				"COPYING" : "COPYING3");
                else if (strncmp(buf, "GDB=", strlen("GDB=")) == 0) {
                        fprintf(fp2, "%s\n", sp->GDB);
                        sprintf(target_data.gdb_version, "%s", &sp->GDB[4]);
		} else if (strncmp(buf, "LDFLAGS=", strlen("LDFLAGS=")) == 0) {
                       	fprintf(fp2, "LDFLAGS=%s\n", ldflags ? ldflags : "");
		} else
			fprintf(fp2, "%s", buf);

	}

	makefile_create(&fp1, &fp2);
	show_configuration();
	make_build_data(&target[strlen("TARGET=")]);
}
Exemplo n.º 20
0
    /// Build the topology and setup the simulation
    void setup()
    {

        m_scheduler = m_factory->build_scheduler();

        double channel_error = 0.0;

        auto channel_s_to_r1 =
            m_factory->build_channel(channel_error);

        auto channel_s_to_r2 =
            m_factory->build_channel(channel_error);

        auto channel_r1_to_r3_s1 =
            m_factory->build_channel(channel_error);

        auto channel_r2_to_r3_s2 =
            m_factory->build_channel(channel_error);

        auto channel_r3_to_r4 =
            m_factory->build_channel(channel_error);

        auto channel_r4_to_s1_s2 =
            m_factory->build_channel(channel_error);

        m_scheduler->add_node(channel_s_to_r1);
        m_scheduler->add_node(channel_s_to_r2);
        m_scheduler->add_node(channel_r1_to_r3_s1);
        m_scheduler->add_node(channel_r2_to_r3_s2);
        m_scheduler->add_node(channel_r3_to_r4);
        m_scheduler->add_node(channel_r4_to_s1_s2);

        auto s = m_factory->build_source("source");
        m_s1 = m_factory->build_sink("sink1");
        m_s2 = m_factory->build_sink("sink2");
        auto r1 = m_factory->build_relay("relay1");
        auto r2 = m_factory->build_relay("relay2");
        auto r3 = m_factory->build_relay("relay3");
        auto r4 = m_factory->build_relay("relay4");

        m_scheduler->add_node(s);
        m_scheduler->add_node(m_s1);
        m_scheduler->add_node(m_s2);
        m_scheduler->add_node(r1);
        m_scheduler->add_node(r2);
        m_scheduler->add_node(r3);
        m_scheduler->add_node(r4);

        s->add_output(channel_s_to_r1);
        s->add_output(channel_s_to_r2);

        channel_s_to_r1->add_output(r1);
        channel_s_to_r2->add_output(r2);

        r1->add_output(channel_r1_to_r3_s1);
        channel_r1_to_r3_s1->add_output(r3);
        channel_r1_to_r3_s1->add_output(m_s1);

        r2->add_output(channel_r2_to_r3_s2);
        channel_r2_to_r3_s2->add_output(r3);
        channel_r2_to_r3_s2->add_output(m_s2);

        r3->add_output(channel_r3_to_r4);
        channel_r3_to_r4->add_output(r4);

        r4->add_output(channel_r4_to_s1_s2);
        channel_r4_to_s1_s2->add_output(m_s1);
        channel_r4_to_s1_s2->add_output(m_s2);

        gauge::config_set cs = get_current_configuration();

        // Whether we want to recode at relay3
        bool recode =
            cs.get_value<bool>("recode");


        if (recode)
        {
            r3->set_recode_on();
        }
        else
        {
            r3->set_recode_off();
        }
    }