From f68f16fcc30eb5c4cc1697ec1c1a36b78e215460 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Wed, 2 Dec 2015 16:20:50 +0100 Subject: [PATCH] Added irp_rdtsc to ninja --- src/ninja.py | 4 ++-- src/profile.py | 21 ++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/ninja.py b/src/ninja.py index f8c44e0..b6d98b8 100644 --- a/src/ninja.py +++ b/src/ninja.py @@ -369,8 +369,8 @@ def run(): l_common_s += [ "irp_locks.irp.F90" ] if command_line.do_profile: - l_common_o += [ "irp_profile.irp.o", "rdtsc.o" ] - l_common_s += [ "irp_profile.irp.F90", "rdtsc.c" ] + l_common_o += [ "irp_profile.irp.o", "irp_rdtsc.o" ] + l_common_s += [ "irp_profile.irp.F90", "irp_rdtsc.c" ] l_common_o = map(dress,l_common_o) + map(lambda x: dress(x,in_root=True), OBJ) l_common_s = map(dress,l_common_s) + map(lambda x: dress(x,in_root=True), SRC) diff --git a/src/profile.py b/src/profile.py index 7ff7fe4..15158b2 100644 --- a/src/profile.py +++ b/src/profile.py @@ -45,19 +45,19 @@ import subprocess import tempfile import os import threading +from irpf90_t import irpdir def build_rdtsc(): - file,filename = tempfile.mkstemp() - filename += ".c" + filename = irpdir+"irp_rdtsc.c" file = open(filename,'w') file.write(rdtsc) file.close() - def t(): - p = subprocess.Popen(["gcc","-O2",filename,"-c","-o","irp_rdtsc.o"]) - p.communicate() - os.remove(filename) - - threading.Thread(target=t).start() +# def t(): +# p = subprocess.Popen(["gcc","-O2",filename,"-c","-o","irp_rdtsc.o"]) +# p.communicate() +# os.remove(filename) +# +# threading.Thread(target=t).start() def build_module(): from variables import variables @@ -104,11 +104,10 @@ subroutine irp_init_timer double precision :: irp_rdtsc, t0 irp_profile = 0.d0 irp_rdtsc_shift = 0.d0 - do i=1,1000 + do i=1,1000000 t0 = irp_rdtsc() - irp_rdtsc_shift = irp_rdtsc_shift + (irp_rdtsc()-t0) enddo - irp_rdtsc_shift = 1.d-3*irp_rdtsc_shift + irp_rdtsc_shift = 1.d-6*(irp_rdtsc()-t0) %(text)s end