正常读完文件,然后退出
This commit is contained in:
parent
588abd70f2
commit
bcb8b420ba
|
|
@ -59,7 +59,7 @@ void parseSamHeader(FILE *fp, HeaderBuf &hdrBuf) {
|
|||
blockLen = unpackInt16(&fBuf[16]) + 1;
|
||||
readState = fread(&fBuf[BLOCK_HEADER_LENGTH], 1, blockLen - BLOCK_HEADER_LENGTH, fp);
|
||||
header = sam_hdr_init();
|
||||
|
||||
spdlog::info("Header file size: {}", blockLen);
|
||||
|
||||
uint32_t crc = le_to_u32(fBuf + blockLen - 8);
|
||||
int ret = bgzfUncompress(uData.data, &dlen, (Bytef *)fBuf + 18, blockLen - 18, crc);
|
||||
|
|
|
|||
|
|
@ -269,6 +269,7 @@ static void *nonBlockingUncompress(void *data) {
|
|||
else
|
||||
((SortData *)data)->round++;
|
||||
|
||||
// spdlog::info("block arr size: {}", ((SortData *)data)->blockAddrArr->size());
|
||||
kt_for(nsgv::gSortArg.NUM_THREADS, mtUncompressBlock, data, ((SortData *)data)->blockAddrArr->size());
|
||||
// kt_for(nsgv::gSortArg.NUM_THREADS, mtUncompressBlock, data, nsgv::gSortArg.NUM_THREADS);
|
||||
PROF_G_END(uncompress);
|
||||
|
|
@ -343,13 +344,16 @@ int doSort() {
|
|||
|
||||
// 测试读取bam的速度
|
||||
|
||||
int max_bam_len = 0;
|
||||
bam1_t *bamp = bam_init1();
|
||||
while (sam_read1(inBamFp, inBamHdr, bamp) >= 0) {
|
||||
if (max_bam_len < bamp->l_data) max_bam_len = bamp->l_data;
|
||||
if (bamp->l_data > 1000) {
|
||||
spdlog::info("large record len: {}", bamp->l_data);
|
||||
}
|
||||
}
|
||||
sam_close(inBamFp);
|
||||
spdlog::info("max record len: {}", max_bam_len);
|
||||
return 0;
|
||||
|
||||
#endif
|
||||
|
|
@ -365,6 +369,8 @@ int doSort() {
|
|||
// 打开文件
|
||||
FILE *fpr = fopen(nsgv::gSortArg.INPUT_FILE.c_str(), "rb");
|
||||
|
||||
// threadRead(fpr); exit(0);
|
||||
|
||||
parseSamHeader(fpr, nsgv::gInHdr);
|
||||
|
||||
// FILE *fpw = fopen(nsgv::gSortArg.OUTPUT_FILE.c_str(), "rb");
|
||||
|
|
@ -449,6 +455,7 @@ int doSort() {
|
|||
PROF_G_END(read);
|
||||
|
||||
while (readState > 0) {
|
||||
//spdlog::info("readState-0: {}", readState);
|
||||
// while (readState > 0) {
|
||||
PROF_G_BEG(parse_block);
|
||||
curStartAddrArr->clear();
|
||||
|
|
@ -477,6 +484,7 @@ int doSort() {
|
|||
// exit(0);
|
||||
|
||||
READ_BLOCKS;
|
||||
// spdlog::info("read block len: {}", blockLen);
|
||||
|
||||
// spdlog::info("cur block size: {}", curStartAddrArr->size());
|
||||
|
||||
|
|
@ -513,12 +521,14 @@ int doSort() {
|
|||
SWITCH_POINTER;
|
||||
|
||||
PROF_G_BEG(read);
|
||||
// readState = fread(curBuf, 1, READ_BUFSIZE, fpr);
|
||||
readState = fread(curBuf, 1, READ_BUFSIZE, fpr);
|
||||
//spdlog::info("readState: {}", readState);
|
||||
PROF_G_BEG(mem_copy);
|
||||
memcpy(curBuf, fbuf[4], READ_BUFSIZE); readState = READ_BUFSIZE;
|
||||
// memcpy(curBuf, fbuf[4], readState); readState = READ_BUFSIZE;
|
||||
memcpy(curBuf, fbuf[4], readState);
|
||||
PROF_G_END(mem_copy);
|
||||
PROF_G_END(read);
|
||||
if (fsize >= 6245369164) break;
|
||||
// if (fsize >= 6245369164) break;
|
||||
}
|
||||
pthread_join(uncompressTid, NULL);
|
||||
PROF_G_END(mid_all);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ struct TemplateCoordinateKey {
|
|||
// Struct which contains the a record, and the pointer to the sort tag (if any) or
|
||||
// a combined ref / position / strand.
|
||||
// Used to speed up sorts (coordinate, by-tag, and template-coordinate).
|
||||
typedef struct BamSortTag {
|
||||
struct BamSortTag {
|
||||
bam1_t *bam_record;
|
||||
union {
|
||||
const uint8_t *tag;
|
||||
|
|
|
|||
Loading…
Reference in New Issue