From 01cd29badb2a672e85da3ddbccc4f122158e5d6d Mon Sep 17 00:00:00 2001 From: Ed Schmerling Date: Sun, 19 May 2019 15:12:52 -0700 Subject: [PATCH] Replace REQUIRE with Project.toml --- .travis.yml | 14 ++++++++------ Project.toml | 13 +++++++++++++ REQUIRE | 2 -- src/CPUTime.jl | 16 +++++++--------- test/runtests.jl | 6 +++--- 5 files changed, 31 insertions(+), 20 deletions(-) create mode 100644 Project.toml delete mode 100644 REQUIRE diff --git a/.travis.yml b/.travis.yml index 61f23c7..064500d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,12 @@ +## Documentation: http://docs.travis-ci.com/user/languages/julia/ language: julia -notifications: - email: false +os: + - linux + - osx julia: - - 0.6 - 0.7 + - 1.0 + - 1.1 - nightly -#script: -# - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi -# - julia -e 'Pkg.init(); Pkg.clone(pwd()); Pkg.test("CPUTime")' +notifications: + email: false diff --git a/Project.toml b/Project.toml new file mode 100644 index 0000000..5f62191 --- /dev/null +++ b/Project.toml @@ -0,0 +1,13 @@ +name = "CPUTime" +uuid = "a9c8d775-2e2e-55fc-8582-045d282d599e" +authors = ["Ed Schmerling "] +version = "1.0.0" + +[compat] +julia = "≥ 0.7.0" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/REQUIRE b/REQUIRE deleted file mode 100644 index c0cc4fd..0000000 --- a/REQUIRE +++ /dev/null @@ -1,2 +0,0 @@ -julia 0.6 -Compat 0.41 diff --git a/src/CPUTime.jl b/src/CPUTime.jl index 644da2a..4a84375 100644 --- a/src/CPUTime.jl +++ b/src/CPUTime.jl @@ -1,7 +1,5 @@ module CPUTime -using Compat - export CPUtime_us, CPUtic, @@ -11,14 +9,14 @@ export @CPUelapsed function CPUtime_us() - @compat rusage = Libc.malloc(4*sizeof(Clong) + 14*sizeof(UInt64)) # sizeof(uv_rusage_t); this is different from sizeof(rusage) + rusage = Libc.malloc(4*sizeof(Clong) + 14*sizeof(UInt64)) # sizeof(uv_rusage_t); this is different from sizeof(rusage) ccall(:uv_getrusage, Cint, (Ptr{Nothing},), rusage) - @compat utime = UInt64(1000000)*unsafe_load(convert(Ptr{Clong}, rusage + 0*sizeof(Clong))) + # user CPU time - unsafe_load(convert(Ptr{Clong}, rusage + 1*sizeof(Clong))) - @compat stime = UInt64(1000000)*unsafe_load(convert(Ptr{Clong}, rusage + 2*sizeof(Clong))) + # system CPU time - unsafe_load(convert(Ptr{Clong}, rusage + 3*sizeof(Clong))) + utime = UInt64(1000000)*unsafe_load(convert(Ptr{Clong}, rusage + 0*sizeof(Clong))) + # user CPU time + unsafe_load(convert(Ptr{Clong}, rusage + 1*sizeof(Clong))) + stime = UInt64(1000000)*unsafe_load(convert(Ptr{Clong}, rusage + 2*sizeof(Clong))) + # system CPU time + unsafe_load(convert(Ptr{Clong}, rusage + 3*sizeof(Clong))) ttime = utime + stime # total CPU time - @compat Libc.free(rusage) + Libc.free(rusage) return ttime end @@ -34,7 +32,7 @@ function CPUtoq() if timers === () error("CPUtoc() without CPUtic()") end - @compat t0 = timers[1]::UInt64 + t0 = timers[1]::UInt64 task_local_storage(:CPUTIMERS, timers[2]) (t1-t0)/1e6 end diff --git a/test/runtests.jl b/test/runtests.jl index 93c8347..f611d48 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,9 +1,9 @@ using CPUTime -using Compat.Test +using Test function add_and_sleep() x = 0 - for i in 1:1e7 + for i in 1:10_000_000 x += i end sleep(1) @@ -18,4 +18,4 @@ end time_difference() # compilation overhead should not affect results, but just in case time_diff = time_difference() -eval(Meta.parse("@test abs($time_diff - 1.0) <= .01")) +eval(Meta.parse("@test abs($time_diff - 1.0) <= .1"))