You can try using ltrace
with the -c
trace (very similar to strace
but for library calls instead of system calls). This won't be complete as actually profiling the code and might not be the CPU time breakdown you are looking for, but it might just be the quick syadmin level tool you need.
kbrandt@kbrandt-acer:~$ ltrace -c xcalc
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
66.83 0.222693 4453 50 XtCreateManagedWidget
28.52 0.095048 95048 1 XtAppInitialize
0.85 0.002837 2837 1 XtRealizeWidget
0.83 0.002764 2764 1 XSetWMProtocols
0.77 0.002581 2581 1 XtGetApplicationResources
0.42 0.001383 53 26 XtWindow
0.41 0.001371 54 25 XtDisplay
...
------ ----------- ----------- --------- --------------------
100.00 0.333219 168 total
strace
also with the -c
switch will give you similar output but will show the system calls (the calls the libraries are using -- so sort of a level deeper).
The caveat with both of these break downs is these are wall clock time spent on each call and it doesn't show if this was active or idle time.
If you have the code and want to go all out you want code profiling. Stack Overflows "What can I use to profile my C++ code in Linux?" should get you started. I have used Valgrind with C code and liked it.
I would choose a consistent approach across the entire environment. Both solutions work fine and will remain compatible with most applications. There is a difference in manageability, though.
I go with the short name as the HOSTNAME setting, and set the FQDN as the first column in /etc/hosts
for the server's IP, followed by the short name.
I have not encountered many software packages that enforce or display a preference between the two. I find the short name to be cleaner for some applications, specifically logging. Maybe I've been unlucky in seeing internal domains like server.northside.chicago.rizzomanufacturing.com
. Who wants to see that in the logs or a shell prompt?
Sometimes, I'm involved in company acquisitions or restructuring where internal domains and/or subdomains change. I like using the short hostname in these cases because logging, kickstarts, printing, systems monitoring, etc. do not need full reconfiguration to account for the new domain names.
A typical RHEL/CentOS server setup for a server named "rizzo" with internal domain "ifp.com", would look like:
/etc/sysconfig/network:
HOSTNAME=rizzo
...
-
/etc/hosts:
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
172.16.100.13 rizzo.ifp.com rizzo
-
[root@rizzo ~]# hostname
rizzo
-
/var/log/messages snippet:
Dec 15 10:10:13 rizzo proftpd[19675]: 172.16.100.13 (::ffff:206.15.236.182[::ffff:206.15.236.182]) - Preparing to
chroot to directory '/app/upload/GREEK'
Dec 15 10:10:51 rizzo proftpd[20660]: 172.16.100.13 (::ffff:12.28.170.2[::ffff:12.28.170.2]) - FTP session opened.
Dec 15 10:10:51 rizzo proftpd[20660]: 172.16.100.13 (::ffff:12.28.170.2[::ffff:12.28.170.2]) - Preparing to chroot
to directory '/app/upload/ftp/SRRID'
Best Answer
I'd look at atop and psacct.
Also, I have to ask if you really mean Red Hat 6.2 or RHEL 6.2.