本文整理汇总了C++中stripedio::managed_malloc方法的典型用法代码示例。如果您正苦于以下问题:C++ stripedio::managed_malloc方法的具体用法?C++ stripedio::managed_malloc怎么用?C++ stripedio::managed_malloc使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类stripedio
的用法示例。
在下文中一共展示了stripedio::managed_malloc方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: load
// TODO: recycle ptr!
void load() {
is_loaded = true;
adjfilesize = get_filesize(filename_adj);
edatafilesize = get_filesize(filename_edata);
bool async_inedgedata_loading = !svertex_t().computational_edges();
#ifdef SUPPORT_DELETIONS
async_inedgedata_loading = false; // Currently we encode the deleted status of an edge into the edge value (should be changed!),
// so we need the edge data while loading
#endif
//preada(adjf, adjdata, adjfilesize, 0);
adj_session = iomgr->open_session(filename_adj, true);
iomgr->managed_malloc(adj_session, &adjdata, adjfilesize, 0);
adj_stream_session = streaming_task(iomgr, adj_session, adjfilesize, (char**) &adjdata);
iomgr->launch_stream_reader(&adj_stream_session);
/* Initialize edge data asynchonous reading */
if (!only_adjacency) {
edata_iosession = iomgr->open_session(filename_edata, false);
iomgr->managed_malloc(edata_iosession, &edgedata, edatafilesize, 0);
if (async_inedgedata_loading) {
iomgr->managed_preada_async(edata_iosession, &edgedata, edatafilesize, 0);
} else {
iomgr->managed_preada_now(edata_iosession, &edgedata, edatafilesize, 0);
}
}
}
示例2: check_curblock
inline void check_curblock(size_t toread) {
if (curblock == NULL || curblock->end < edataoffset+toread) {
if (curblock != NULL) {
if (!curblock->active) {
curblock->release(iomgr);
}
}
// Load next
std::string blockfilename = filename_shard_edata_block(filename_edata, (int) (edataoffset / blocksize), blocksize);
int edata_session = iomgr->open_session(blockfilename, false, true);
sblock<ET> newblock(edata_session, edata_session, true, blockfilename);
// We align blocks always to the blocksize, even if that requires
// allocating and reading some unnecessary data.
newblock.offset = (edataoffset / blocksize) * blocksize; // Align
size_t correction = edataoffset - newblock.offset;
newblock.end = std::min(edatafilesize, newblock.offset + blocksize);
assert(newblock.end >= newblock.offset);
int realsize = get_block_uncompressed_size(blockfilename, newblock.end - newblock.offset);
iomgr->managed_malloc(edata_session, &newblock.data, realsize, newblock.offset);
newblock.ptr = newblock.data + correction;
activeblocks.push_back(newblock);
curblock = &activeblocks[activeblocks.size()-1];
curblock->active = true;
curblock->read_now(iomgr);
}
}
示例3: load_block
vdblock load_block(int blockid) {
vdblock db(blockid);
std::string blockfname = blockfilename(blockid);
db.fd = iomgr->open_session(blockfname, false, true);
int realsize = get_block_uncompressed_size(blockfname, -1);
assert(realsize > 0);
iomgr->managed_malloc(db.fd, &db.data, realsize, 0);
iomgr->managed_preada_now(db.fd, &db.data, realsize, 0);
db.dblock = new dynamicdata_block<VertexDataType>(verticesperblock, (uint8_t *)db.data, realsize);
return db;
}
示例4: load
/**
* Loads a chunk of vertex degrees
* @param vertex_st first vertex id
* @param vertex_en last vertex id, inclusive
*/
virtual void load(vid_t _vertex_st, vid_t _vertex_en) {
assert(_vertex_en >= _vertex_st);
vertex_st = _vertex_st;
vertex_en = _vertex_en;
size_t datasize = (vertex_en - vertex_st + 1) * sizeof(degree);
size_t datastart = vertex_st * sizeof(degree);
if (loaded_chunk != NULL) {
iomgr->managed_release(filedesc, &loaded_chunk);
}
iomgr->managed_malloc(filedesc, &loaded_chunk, datasize, datastart);
iomgr->managed_preada_now(filedesc, &loaded_chunk, datasize, datastart);
}
示例5: load
/**
* Loads a chunk of vertex values
* @param vertex_st first vertex id
* @param vertex_en last vertex id, inclusive
*/
virtual void load(vid_t _vertex_st, vid_t _vertex_en) {
if (!use_mmap) {
assert(_vertex_en >= _vertex_st);
vertex_st = _vertex_st;
vertex_en = _vertex_en;
size_t datasize = (vertex_en - vertex_st + 1)* sizeof(VertexDataType);
size_t datastart = vertex_st * sizeof(VertexDataType);
if (loaded_chunk != NULL) {
iomgr->managed_release(filedesc, &loaded_chunk);
}
iomgr->managed_malloc(filedesc, &loaded_chunk, datasize, datastart);
iomgr->managed_preada_now(filedesc, &loaded_chunk, datasize, datastart);
} else {
// Do nothing
}
}
示例6: check_adjblock
inline void check_adjblock(size_t toread) {
if (curadjblock == NULL || curadjblock->end <= adjoffset + toread) {
if (curadjblock != NULL) {
curadjblock->release(iomgr);
delete curadjblock;
curadjblock = NULL;
}
sblock<ET> * newblock = new sblock<ET>(0, adjfile_session);
newblock->offset = adjoffset;
newblock->end = std::min(adjfilesize, adjoffset+blocksize);
assert(newblock->end > 0);
assert(newblock->end >= newblock->offset);
iomgr->managed_malloc(adjfile_session, &newblock->data, newblock->end - newblock->offset, adjoffset);
newblock->ptr = newblock->data;
metrics_entry me = m.start_time();
iomgr->managed_preada_now(adjfile_session, &newblock->data, newblock->end - newblock->offset, adjoffset);
m.stop_time(me, "blockload");
curadjblock = newblock;
}
}