General :: Get The Values For The User Time And System Time For A Process?
Aug 4, 2009
get the values for the user time and system time for a process.i have tried getrusage to get values of ru_utime and ru_stimebut these don't seem to be correct
I am currently struggling with one of my tasks.I was asked to find a way how to determine how much time an _already running_ process is spending in user and kernel space.E.G. <some tool> <pid>[Control] + [c]<pid> spent 12.1 seconds in user and 1.52 seconds in kernel space.Does something like this exist? Basically I guess I am looking for something similar to time, except that the process is already running.So..a) Is there a tool which fulfills this task?b) Is there a way to write your own software which does the job? Is it even possible to code something I am looking for?I recently found strace -c -p <pid>, but well, this is not exactly what I was looking for.
I'm just wondering what the limits for time are. I have a program that always takes exactly 20 ms, so I assume this is the lowest it can measure, but I want to see if there's some sort of documentation of this.
1. How sum of system time and user time can be greater than real time ? 2. Even though my program is not waiting for any I/O the real time is smaller than system time as shown
root@chaitu:/home/chaitu/Desktop/Chk# time ./new real0m0.001s user0m0.000s sys0m0.004s
I need to edit the system time as a not-root user. I am carrying out the following actions in my program.
1. Read the User Id of the process. User_ID= getuid() 2. Printing Capabilities(Permitted, Efffective, Inheritable)of the process 3. Setting UID = 0, using setuid(0) 4. Calling the prctl(), function to keep capabilities 5.Switching the UID from root to User_ID of the process 6. What we have now is a process with root capabilities as a non root user 7. On printing Permitted, Effective, Inheritable capabilities, I get the following --> Permitted = 0xfffffeff = Effective Inheritable = 0x0; with UID = 1001; 8. I then try and set the system time with --> system("date -s 10:00"); 9. I get an error: date: cannot set date: Operation not permitted 10. I am unable to understand as to why I cannot set the time even thought the capability bit CAP_SYS_TIME in the Permitted and Effective sets are SET.
When booting Fedora 11, my system hangs for a very long time on starting udev. Sometimes I get an I/O error. However, my hardware is fine. I do eventually get in to the system.
I am running my Ubuntu 32 bit server on top of Windows 7 64 bit with VirualBox. It's a 2 core Atom. It's been working good for about half a year. But the last about 6 weeks the system time only in Ubuntu is going slow. About -8 per 24 hours! I can only guess because I have more things running in my Windows 7 and Ubuntu.
I can set it right by coping the hareware time to system time with this command:
Code: hwclock --hctosys
I want to run a crontab to have that command run every minute. But it don't seem to run.
I have developed an application, in C language, that should received the EPOCH time (6 bytes) at about every 30 min. What function should I use as a non root user to modify the System Time.? The idea is that the same application could update the System Time. I am using Ubuntu.
I installed Ubuntu inside windows(Win 7).Both works good.I found that system time is wrong in both OS.Every time i Change it manually but it changes again on reboot!
I started to use linux (CentOS 5) 1 week ago. And I took lot of imformation from this forum. Is it possible to install two program at same time? Total download size: 67 M Is this ok [y/N]: y Downloading Packages: jdk-6u24-linux-i586.rpm 19% [========-] 6.0 kB/s | 13 MB 153:51 ETA It is so boring to wait and I have to wait there is nothing to do something else just centOs text.
I want to limit the time a grep process command is allowed to run or be alive.For example. I want to perform the following:grep -qsRw -m1 "parameter" /varBut before running the grep command I want to limit how long the grep process is to live, say no longer than 30 seconds.How do I do this?And if it can, how do I return or reset to have no time limit afterwards.
It's pid is increasing all the time... I'm writing a program to display all the process's info, this process really bother me. Oh..the Chinese words are sleeping..., can't use, can't use
Centos 5.4 64bitWould like to know when a particular process was started.1.Quote:ll -d /proc/4014/dr-xr-xr-x 5 mysql mysql 0 Nov 28 07:34 /proc/4014/2.Quote:ps -o pid,lstart -p 4014 PIDSTARTED 4014 Tue Nov 17 23:10:13 20091) Which one should I consider?2) why do both have such a difference?
Possibly related to this previous question, I would like to be able to run a task for a specified amount of time, then stop/kill it, then start it again. Specifically, I run the Folding@Home application on my Linux workstation. Periodically, it will have trouble logging-in to the home server, and will sit idle for a long time, but not release memory/resources it has claimed (yes, I realize this is likely a bug in the tool, but I can't fix that currently). Typically just the act of killing and starting the tool will allow it to check-in again. So, I would like to be able to run something like:
run_for <time> ./fah6
Does such a tool exist, or should I write a wrapper than nukes the fah6 client after, say, a week and restart it?
I'm rather new to linux, and I have a dedi server. I know how to browse, install, remove etc, all the basics needed to use it. I've installed flvtool2, memcoder and ffmpeg, and at the moment im converting avi files in to flv. Im then passing metadata using yamdi.
However, this process is very timely as im converting loads of avi files at a time.Im looking for a script, or a way where I can execute one command/script and which will convert all files in the directory I specify, then run those converted files through yamdi.Im guessing it would be some sort of loop, and then changing for each file?
logging in a server through putty in the same network when i executed last command its showing system ip logged in time and logged out time the output as followsthis is my system oot pts1 xx.xx.xx day month date time in time out timeand similarly am geeting other than this likeroot :0day month date time still logged in this is from more than 3 days its logged in
I have a linux (Slackware) machine and the time/date is like, June 23rd 2003, 10:00am (It's 11 here) and I am not able to set the time to have it correct. I change the timezome to Montreal but the time is still wrong.
Is there a way to force it to sync with my domain controler or even another online NTP server?
My computer has different time when booting to linux or Windows.How to make the time the same?My computer time is 10:57pm Apr 14 when booting to linux.My computer time is 2:57am Apr 14 when booting to Windows Vista Home Premimum SP2.Both OS are set to the same time zone (GMT-5. Eastern Time US & Canada).
I admit this has been a particularly bad year for me, but it isn't THAT unusual by my standards. I typically spend I would reckon quite honestly about 70-80% of my time with computers just fixing stuff up that either I broke or was broke in the first place. Usually it's the latter by some considerable margin. That's really inefficient, isn't it? I just wondered what others' experiences are of this phenomenon. Obviously I don't do computers for a living or I would have starved years ago. So what is the Panel's consensus view on the percentage of wasted time we should expect to spend, on average, "running just to stand still" on maintenance tasks?
Okay so I am a total newb to linux. I installed Ubuntu using Wubi and am trying to figure out how to get my wireless connection working. It occurred to me I may not have the right driver for use with Ubuntu for the wireless connection at my house. I couldn't find anything on the web to help..it appears I have a realtek RTL8102E wireless card in my laptop. I have absolutely no idea how to resolve this situation..I've looked on the web, but everythings pretty confusing. If I could get the wireless working it would be a good first step.
When I use the `date' command on RHEL5, I can get the time shown in 24 hr format. I wonder if the time can be shown in 12 hr format. But I don't want to use the `date +FORMAT' to do that, neither `alias date='date +FORMAT''. I just want a simple `date' to show time in 12hr format.Is there any configuration file about the 12/24 hr format? Is the format related to the value of the environment variable 'TIMEFORMAT'? I can't find its default value by 'set | grep -i timeformat'.How can I know what the current format is? I mean, when I use `date', I can get "Sun Sep 19 13:22:50 CST 2010", which seems like 24hr format; but when I use `hwclock', I can get "Sun 19 Sep 2010 01:23:05 PM CST -0.174299 seconds", which seems like 12hr format.
I want to get the system idle time till a mouse move or a key press. How is it possible to get it from a char terminal running through ssh/telnet as well as a from an X-terminal session?
I have a desktop PC with Fedora, Ubuntu and Windows installed and grub used for multibooting. But time in Fedora is always 5 hours behind. If I change the time in Fedora, then Windows and Ubuntu will be 5 hours ahead of the current time. I don't understand how to fix it.