添加了运行时间计算代码,用来分析性能
This commit is contained in:
parent
293f3bb80e
commit
c981585fd2
3
Makefile
3
Makefile
|
|
@ -3,8 +3,9 @@ CC= gcc
|
||||||
# CFLAGS= -g -Wall -Wno-unused-function -O2
|
# CFLAGS= -g -Wall -Wno-unused-function -O2
|
||||||
CFLAGS= -g -Wall -Wno-unused-function -O2
|
CFLAGS= -g -Wall -Wno-unused-function -O2
|
||||||
WRAP_MALLOC=-DUSE_MALLOC_WRAPPERS
|
WRAP_MALLOC=-DUSE_MALLOC_WRAPPERS
|
||||||
|
SHOW_PERF= -DSHOW_PERF
|
||||||
AR= ar
|
AR= ar
|
||||||
DFLAGS= -DHAVE_PTHREAD $(WRAP_MALLOC)
|
DFLAGS= -DHAVE_PTHREAD $(WRAP_MALLOC) $(SHOW_PERF)
|
||||||
LOBJS= utils.o kthread.o kstring.o ksw.o bwt.o bntseq.o bwa.o bwamem.o bwamem_pair.o bwamem_extra.o malloc_wrap.o \
|
LOBJS= utils.o kthread.o kstring.o ksw.o bwt.o bntseq.o bwa.o bwamem.o bwamem_pair.o bwamem_extra.o malloc_wrap.o \
|
||||||
QSufSort.o bwt_gen.o rope.o rle.o is.o bwtindex.o
|
QSufSort.o bwt_gen.o rope.o rle.o is.o bwtindex.o
|
||||||
AOBJS= bwashm.o bwase.o bwaseqio.o bwtgap.o bwtaln.o bamlite.o \
|
AOBJS= bwashm.o bwase.o bwaseqio.o bwtgap.o bwtaln.o bamlite.o \
|
||||||
|
|
|
||||||
7
bwamem.c
7
bwamem.c
|
|
@ -306,7 +306,14 @@ mem_chain_v mem_chain(const mem_opt_t *opt, const bwt_t *bwt, const bntseq_t *bn
|
||||||
mem_chain_t tmp, *lower, *upper;
|
mem_chain_t tmp, *lower, *upper;
|
||||||
mem_seed_t s;
|
mem_seed_t s;
|
||||||
int rid, to_add = 0;
|
int rid, to_add = 0;
|
||||||
|
#ifdef SHOW_PERF
|
||||||
|
int64_t tmp_time = realtime_msec();
|
||||||
|
#endif
|
||||||
s.rbeg = tmp.pos = bwt_sa(bwt, p->x[0] + k); // this is the base coordinate in the forward-reverse reference
|
s.rbeg = tmp.pos = bwt_sa(bwt, p->x[0] + k); // this is the base coordinate in the forward-reverse reference
|
||||||
|
#ifdef SHOW_PERF
|
||||||
|
tmp_time = realtime_msec() - tmp_time;
|
||||||
|
__sync_fetch_and_add(&time_bwt_sa, tmp_time);
|
||||||
|
#endif
|
||||||
s.qbeg = p->info >> 32;
|
s.qbeg = p->info >> 32;
|
||||||
s.score= s.len = slen;
|
s.score= s.len = slen;
|
||||||
rid = bns_intv2rid(bns, s.rbeg, s.rbeg + s.len);
|
rid = bns_intv2rid(bns, s.rbeg, s.rbeg + s.len);
|
||||||
|
|
|
||||||
19
fastmap.c
19
fastmap.c
|
|
@ -41,6 +41,18 @@
|
||||||
#include "fmt_idx.h"
|
#include "fmt_idx.h"
|
||||||
KSEQ_DECLARE(gzFile)
|
KSEQ_DECLARE(gzFile)
|
||||||
|
|
||||||
|
// 记录运行时间的变量
|
||||||
|
#ifdef SHOW_PERF
|
||||||
|
|
||||||
|
int64_t time_ksw_extend2 = 0,
|
||||||
|
time_ksw_global2 = 0,
|
||||||
|
time_ksw_align2 = 0,
|
||||||
|
time_bwt_smem1a = 0,
|
||||||
|
time_bwt_occ4 = 0,
|
||||||
|
time_bwt_sa = 0;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
extern unsigned char nst_nt4_table[256];
|
extern unsigned char nst_nt4_table[256];
|
||||||
|
|
||||||
void *kopen(const char *fn, int *_fd);
|
void *kopen(const char *fn, int *_fd);
|
||||||
|
|
@ -406,6 +418,13 @@ int main_mem(int argc, char *argv[])
|
||||||
kseq_destroy(aux.ks2);
|
kseq_destroy(aux.ks2);
|
||||||
err_gzclose(fp2); kclose(ko2);
|
err_gzclose(fp2); kclose(ko2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SHOW_PERF
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
fprintf(stderr, "time_bwt_sa: %f s\n", time_bwt_sa / 1000.0 / opt->n_threads);
|
||||||
|
fprintf(stderr, "\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,5 @@ void BuildBwtdFromBwt(bwt_t *bwt, bwtd_t **bwtd_p) {
|
||||||
|
|
||||||
printf("kmer size: %ld M\n", kmerSize * sizeof(kmer_range_t) / 1024 / 1024);
|
printf("kmer size: %ld M\n", kmerSize * sizeof(kmer_range_t) / 1024 / 1024);
|
||||||
|
|
||||||
exit(0);
|
// exit(0);
|
||||||
}
|
}
|
||||||
4
run.sh
4
run.sh
|
|
@ -1,7 +1,7 @@
|
||||||
time ./bwa mem -t 1 -M -R @RG\\tID:normal\\tSM:normal\\tPL:illumina\\tLB:normal\\tPG:bwa \
|
time ./bwa mem -t 12 -M -R @RG\\tID:normal\\tSM:normal\\tPL:illumina\\tLB:normal\\tPG:bwa \
|
||||||
/home/zzh/data/reference/human_g1k_v37_decoy.fasta \
|
/home/zzh/data/reference/human_g1k_v37_decoy.fasta \
|
||||||
/home/zzh/data/fastq/nm1.fq \
|
/home/zzh/data/fastq/nm1.fq \
|
||||||
/home/zzh/data/fastq/nm2.fq #-o /dev/null
|
/home/zzh/data/fastq/nm2.fq -o /dev/null
|
||||||
|
|
||||||
# time ./bwa mem -t 1 -M -R @RG\\tID:normal\\tSM:normal\\tPL:illumina\\tLB:normal\\tPG:bwa \
|
# time ./bwa mem -t 1 -M -R @RG\\tID:normal\\tSM:normal\\tPL:illumina\\tLB:normal\\tPG:bwa \
|
||||||
# /public/home/zzh/data/reference/human_g1k_v37_decoy.fasta \
|
# /public/home/zzh/data/reference/human_g1k_v37_decoy.fasta \
|
||||||
|
|
|
||||||
7
utils.c
7
utils.c
|
|
@ -294,6 +294,13 @@ double realtime(void)
|
||||||
return tp.tv_sec + tp.tv_usec * 1e-6;
|
return tp.tv_sec + tp.tv_usec * 1e-6;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t realtime_msec(void)
|
||||||
|
{
|
||||||
|
struct timeval tv;
|
||||||
|
gettimeofday(&tv, NULL);
|
||||||
|
return (int64_t)1000 * (tv.tv_sec + ((1e-6) * tv.tv_usec));
|
||||||
|
}
|
||||||
|
|
||||||
long peakrss(void)
|
long peakrss(void)
|
||||||
{
|
{
|
||||||
struct rusage r;
|
struct rusage r;
|
||||||
|
|
|
||||||
12
utils.h
12
utils.h
|
|
@ -31,6 +31,17 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <zlib.h>
|
#include <zlib.h>
|
||||||
|
|
||||||
|
#ifdef SHOW_PERF
|
||||||
|
|
||||||
|
extern int64_t time_ksw_extend2,
|
||||||
|
time_ksw_global2,
|
||||||
|
time_ksw_align2,
|
||||||
|
time_bwt_smem1a,
|
||||||
|
time_bwt_occ4,
|
||||||
|
time_bwt_sa;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
// Tell GCC to validate printf format string and args
|
// Tell GCC to validate printf format string and args
|
||||||
#define ATTRIBUTE(list) __attribute__ (list)
|
#define ATTRIBUTE(list) __attribute__ (list)
|
||||||
|
|
@ -86,6 +97,7 @@ extern "C" {
|
||||||
|
|
||||||
double cputime(void);
|
double cputime(void);
|
||||||
double realtime(void);
|
double realtime(void);
|
||||||
|
int64_t realtime_msec(void);
|
||||||
long peakrss(void);
|
long peakrss(void);
|
||||||
|
|
||||||
void ks_introsort_64 (size_t n, uint64_t *a);
|
void ks_introsort_64 (size_t n, uint64_t *a);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue