def METHOD_NAME(self):
    class ModuleThatTimes(torch.jit.ScriptModule):
        def forward(self, x):
            tp_start = torch.jit._logging.time_point()
            for i in range(30):
                x += 1.0
            tp_end = torch.jit._logging.time_point()
            torch.jit._logging.add_stat_value('mytimer', tp_end - tp_start)
            return x
    mtm = ModuleThatTimes()
    logger = torch.jit._logging.LockingLogger()
    old_logger = torch.jit._logging.set_logger(logger)
    try:
        mtm(torch.rand(3, 4))
        self.assertGreater(logger.get_counter_val('mytimer'), 0)
    finally:
        torch.jit._logging.set_logger(old_logger)