Skip to content

Wrong toc() message for nested timing #11

Description

@kbzsl

It is working well, when all the messages are defined in the toc() function.

tictoc::tic("T1")
tictoc::tic("T2")
Sys.sleep(1)
tictoc::toc()
#> T2: 1 sec elapsed
Sys.sleep(2)
tictoc::toc()
#> T1: 3.03 sec elapsed

But if one of the messages is not defined, the message order is not kept.

tictoc::tic("T1")
tictoc::tic()
Sys.sleep(1)
tictoc::toc()
#> T1: 1.03 sec elapsed
Sys.sleep(2)
tictoc::toc()
#> 3.08 sec elapsed
tictoc::tic("T1")
tictoc::tic()
tictoc::tic("T3")
tictoc::tic()
Sys.sleep(1)
tictoc::toc()
#> T3: 1.03 sec elapsed
Sys.sleep(2)
tictoc::toc()
#> T1: 3.06 sec elapsed
Sys.sleep(3)
tictoc::toc()
#> 6.11 sec elapsed
Sys.sleep(4)
tictoc::toc()
#> 10.15 sec elapsed

It looks like that the missing message (msg = NULL) is not registered correctly.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions