void test5() { sc_uint32 i; sc_addr addr; sc_stream *stream = 0; printf("Segments count: %d\n", sc_storage_get_segments_count()); print_storage_statistics(); timer = g_timer_new(); printf("Create %d links\n", link_append_count); //g_snprintf(test, 1024, "../CMakeLists.txt"); g_timer_reset(timer); g_timer_start(timer); for (i = 0; i < link_append_count; i++) { addr = sc_storage_link_new(); printf("Created sc-link: seg=%d, offset=%d, content=%d\n", addr.seg, addr.offset, i); stream = sc_stream_memory_new((char*)&i, sizeof(i), SC_STREAM_READ, SC_FALSE); sc_storage_set_link_content(addr, stream); sc_stream_free(stream); } g_timer_stop(timer); printf("Created links: %d\n", link_append_count); printf("Links per second: %f\n", link_append_count / g_timer_elapsed(timer, 0)); printf("Segments count: %d\n", sc_storage_get_segments_count()); print_storage_statistics(); g_timer_destroy(timer); }
sc_addr sc_memory_link_new(sc_memory_context const * ctx) { return sc_storage_link_new(ctx); }