You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: profiler.rs
    path of file: ./repos/occlum/src/libos/src/time
    
    the code of the file until where you have to start completion: use super::*;
use std::fmt::Write;

/// A profiler used inside a thread.
#[derive(Clone, Debug)]
pub struct ThreadProfiler {
    syscall_data: HashMap<SyscallNum, PerfEntry>,
    start_time: ProfileTime,
    status: Status,
}

impl ThreadProfiler {
    pub fn new() -> Self {
        Self {
            syscall_data: HashMap::new(),
            start_time: ProfileTime::TwoTimes {
                real: Duration::new(0, 0),
                cpu: Duration::new(0, 0),
            },
            status: Status::Stopped(TimeSummary::new(
                Duration::new(0, 0),
                Duration::new(0, 0),
                Duration::new(0, 0),
    
    
    pub fn syscall_exit(&mut self, syscall_num: SyscallNum, is_err: bool) -> Result<()> {
        if Self::is_not_traced(syscall_num) {
            return Ok(());
        }

        match self.status {
            Status::InSyscall { start_cpu, num } => {
                if syscall_num != num {
                    eprintln!("current {:?} exit: {:?}", num, syscall_num);
                    return_errno!(EINVAL, "syscall number mismatches");
                }
                self.status = Status::Running;
                let syscall_cpu_time =
                    time::do_thread_getcpuclock()?.as_duration() - start_cpu.get_cputime().unwrap();

                self.syscall_data.entry(num).and_modify(|e| {
                    e.update(syscall_cpu_time, is_err)
                        .expect("fail to update syscall data")
                });
                Ok(())
            }
            _ => return_errno!(
                EINVAL,
                "thread profiler should be in one syscall before exiting the syscall"
            ),
        }
    }