int sigar_thread_cpu_get(sigar_t *sigar, sigar_uint64_t id, sigar_thread_cpu_t *cpu) { #ifdef __ia64__ /* XXX seems _lwp funcs were for solaris compat and dont exist * on itanium. hp docs claim that have equiv functions, * but wtf is it for _lwp_info? */ return SIGAR_ENOTIMPL; #else struct lwpinfo info; if (id != 0) { return SIGAR_ENOTIMPL; } _lwp_info(&info); cpu->user = TIME_NSEC(info.lwp_utime); cpu->sys = TIME_NSEC(info.lwp_stime); cpu->total = TIME_NSEC(info.lwp_utime) + TIME_NSEC(info.lwp_stime); return SIGAR_OK; #endif }
MPERS_PRINTER_DECL(bool, fetch_struct_stat, struct tcb *tcp, const unsigned long addr, struct strace_stat *const dst) { #ifdef HAVE_STRUCT_STAT struct_stat buf; if (umove_or_printaddr(tcp, addr, &buf)) return false; dst->dev = zero_extend_signed_to_ull(buf.st_dev); dst->ino = zero_extend_signed_to_ull(buf.st_ino); dst->rdev = zero_extend_signed_to_ull(buf.st_rdev); dst->size = zero_extend_signed_to_ull(buf.st_size); dst->blocks = zero_extend_signed_to_ull(buf.st_blocks); dst->blksize = zero_extend_signed_to_ull(buf.st_blksize); dst->mode = zero_extend_signed_to_ull(buf.st_mode); dst->nlink = zero_extend_signed_to_ull(buf.st_nlink); dst->uid = zero_extend_signed_to_ull(buf.st_uid); dst->gid = zero_extend_signed_to_ull(buf.st_gid); dst->atime = sign_extend_unsigned_to_ll(buf.st_atime); dst->ctime = sign_extend_unsigned_to_ll(buf.st_ctime); dst->mtime = sign_extend_unsigned_to_ll(buf.st_mtime); dst->atime_nsec = TIME_NSEC(buf.st_atime_nsec); dst->ctime_nsec = TIME_NSEC(buf.st_ctime_nsec); dst->mtime_nsec = TIME_NSEC(buf.st_mtime_nsec); return true; #else /* !HAVE_STRUCT_STAT */ printaddr(addr); return false; #endif }