Programming :: Convert TSC Cpu Cycles Into Seconds In C?
Sep 19, 2010main()
{
unsigned long long tsc_start, tsc_end;
tsc_start = get_tsc();
// execute some code
[code]....
main()
{
unsigned long long tsc_start, tsc_end;
tsc_start = get_tsc();
// execute some code
[code]....
I have a script in the works that reads an MP3 file and gets the track length. Trouble is, it gives me the total seconds, like this:
Sample Track.mp3 = 225.55 seconds
What I'd like to have is that 225.55 converted into minutes:seconds format (in this case, 3:45). How can I do this?
Do I have the convert the int to a string using stringstream then convert the string to a char? or is there a more direct way?Also is there a way to tell the length of a int?
View 5 Replies View RelatedI've got a program that takes keyboard input with BufferedReader and readline(), but readline() is blocking so I can't increment any sort of counter to quit the application after a period of inactivity, because the program is just waiting for an input from readline(). Do I need to create multiple threads, where one thread counts down an inactivity timer, or is there some method of using non-blocking keyboard inputs?
View 1 Replies View RelatedI have a machine running Fedora 14 and a bunch of movies stored on it as '.iso' images. It is connected to my home theater. I used to use VLC to play these movies and it worked great for a long time. About 4 months ago, about an hour or hour-and-a-half into a movie, the audio suddenly "disappears" and the machine goes CRAZY with almost 100% of the CPU spent writing to the SWAP. At first I thought the machine was locked, but it isn't; it's so doggone busy writing swap. I am unable to get enough cycles to terminate anything. I found the swap activity through System Monitor - it was ABRUPT. Sound stopped, machine became preoccupied with swap.
I have removed/reinstalled VLC, the machine has undergone a couple kernel updates, and I have removed/reinstalled a number of things associated with audio (CD ripper, mpeg stuff, etc.) yet the problem persists. I don't know what happened or when (update-wise). Any body got any ideas? While a solution would be great, I'd also be happy with a couple decent suggestions on what to look for.
Never seen this happen before. I'm using the blank screen saver.
View 4 Replies View RelatedI've somehow got it into my head that it's possible to share CPU cycles, though I've no idea where from.So basically that's what I'm asking - is it actually possible to tell one system to 'donate' it's unused CPU time, cycles, whatever they are, for another's use?
View 4 Replies View RelatedI have a couple of question regarding the screen blanker on Gnome desktop.I used to use a 1024x768 display with previous openSUSE distribution. With 11.3, I discovered the new "auto-configure" X feature. The default screen mode was 1600x1200, but I changed it to 1280x1024.My gfx board is a Matrox G400 DH. Hardware acceleration is disable because of a missing mga_dri.so (fall back to software rendering).I find some screen blanker modules are using almost all the CPU cycles. Animations are very slow, and it can take long before a keyboard hit or mouse movement makes to leave the blanker.
So the questions:- Is there a way to define another (smaller) screen resolution just for the blanker ?- Who should I try to convince to add mga_dri.so back in Mesa again ?- When the monitor go to sleep (DPMS), the blanker still is running, uselessly consuming CPU times. (I can see that because at the first mouse/kbd event, the monitor wake up and shows the blanker running.) Is there a way to configure the blanker to stop running when the monitor is sleeping ?- There are some modules which load images from HD (not the diaporama which load images in ~/images). But the shown image is always the default built-in one. Where is the blanker trying to load images from ?
I am running open suse 11.3 and keep up on maintenance. Ever since upgrading to 11.3 I find that the number of cpu cycles is being eaten for apparently nothing. In looking at the system monitor I frequently find that Xorg is using 24% and frequently more than that. What can be done to reduce the cpu cycles, or fix the problem?
View 9 Replies View Related"Servers aren't meant to have GUIs because they are a serious waste of CPU clock cycles." I encountered this line from somewhere here in ubuntu forums, but how could I install tools like mysql wrokbench and stuff, w/c will make my life a lot easier as an administrator? or is there such thing as remote administration?
View 4 Replies View RelatedI'm planning on setting up a new Linux box expressly for distributed computing (BOINC, SETI@home, etc.). All things being equal, what's better- More clock cycles or more cores?
View 4 Replies View RelatedI want to load data into mysql database,I am having a xls file want to convert it into csv file to do it.I am running the script on apache server,was able to convert and I could see the output file,when I execute the php script in command line,but when I run it on the browser the file is not saved..??? .Whether something has to be configured on apache
View 1 Replies View RelatedI have 2 nvidia gfx cards, if I use the nvidia settings tool to view 2 monitors with the same gfx card works fine, when i use one gfx card for one monitor and the other gfx card for the other monitor X doesnt start and just cycles through monitor flashes.
View 2 Replies View RelatedI was running 10.04 until yesterday, when it occured to me that I could upgrade to 10.10. So I went to Software Center, set it to get normal releases and left it to do its job. The upgrade appeared to go without a hitch and I rebooted. The login screen appeared. But just before I could click on my username and enter my password, the screen went blank and a second later the login screen was back. But then just before I could click... Undeterred, after half a minute of frantic clicking I did manage to click on my username and get the password prompt. This time, the login screen didn't go anywhere. Yay. To cut a long story short, this is now my standard logon procedure. However, the plot thickens. I appears that instead of 10.10, I ended up with 11.04, Natty Narwhal, which 'was released in April 2011'. If I download an .iso of Maverick and install it over my current version, will it leave my data unharmed AND reset everything so that it works again?
View 5 Replies View RelatedJust trying to figure out some stuff with a broken process. A java app seems to sometime get stuck on a loop or something and i'm trying to find out what's causing it using just the following #sysadmin tools at my disposal.
Things like:- htop - find the PID thats causing the High CPU cycles. I'd then want to use /proc/[PID] or lsof -p [PID] or strace [PID] etc. But the PID doesn't exist in 'ps -ef' output so I think htop must be showing me kernel level thread PIDs?
Not sure about the PID's HTOP is actually giving me? I know that some of them are the real PID's that can be accessed through /proc/[pid] etc but others are not but are i assume child processes or more likely threads as child processes are normally shown in a default ps output anyway.
Is someone able to help distinguish to me about what exactly all these other PID's are that I can't manipulate or find apart from when using HTOP.
I have an existing line of code from a P2 script that I cannot find a solution to converting to P3:
Code:
for i, x in map(None, list1, list2):
I have found the information about converting the simple case:
map(None,x) becomes list(x)
But my googling was unable to find a solution when more than one iterable exists.
Iam trying to check a value less than or equals 0.The value iam getting is after doing grep a file . but its throwing error .
Code:
When i execute this it throws
Code:
I am trying to write a kernel module which is the combination of the usb driver and a network driver, now whenever the data is recieved by the usb driver it will be in struct urb, but the data that is required by the net driver is sk_buff, now how do i convert a urb to sk_buff, i found something similar is being done in the phonet protocol, but i couldnt understand, howexactly this is being done. Can someone explain this code.
drivers/net/usb/cdc-phonet.c
Code:
static void rx_complete(struct urb *req)
{
struct net_device *dev = req->context;
struct usbpn_dev *pnd = netdev_priv(dev);
[Code]....
I have the source code for the dll file, and I want to convert it to .so file.the dll file has declared some functions like this in the .c file
declspec (dllexport) etc.
I want to use this program in linux(open suse). How to do it? Is it through Wine? Then how to do it exactly.
I've been struggling with suspend to disk (hibernate if you prefer) for a while, it works after a fresh boot and for several days' worth of overnight hibernation as I go about my work, but eventually it stops working - it gets to the splash screen but the bar only makes it a little way to the left before stopping, and then after a timeout the system just returns to the "session locked" screen - no real error messages.
I've done my best to try to find out what's causing it to break but I'm really struggling, the suspend process doesn't appear to write anything helpful to the dmesg log or the /var/log/pm-suspend.log - the only thing that I've seen at about the right point in time is cifsd, but I can't be sure that it's a problem with cifs as hibernate continues to work immediately after mounting windows shares with cifs.
System:
Phenom-II X3
4Gb ram
OpenSUSE 11.1
[code]....
I've searched around and can't find out how to convert a string ( like "12345" ) into an int array ( x[ 5 ] = { 1, 2, 3, 4, 5 } ; ).
View 4 Replies View RelatedI'm learning C and trying to write a program to convert gigabyte into byte. It will take 50% of the value given and then convert that value into byte. But the problem is the output goes into minus / negative value. Like, if I enter 22, I get output: -2147483648.
Code:
#include <stdio.h>
#include <math.h>
main (int argc, char* argv[])
{
[Code]....
I wrote a bash script a few months ago and now I want to convert it to a C program. However, i used awk a lot in my script, and I don't know what to use in place of awk. The awk calls are simple, like string splitting and math, but I don't know of any replacement for the string splitting function. Are there any C libraries that include some sort of string splitting function?
View 4 Replies View RelatedI need to convert some .flac files into .mp3.
I found this script:
#!/bin/bash
FLAC=$1
MP3="${FLAC%.flac}.mp3"
[ -r "$FLAC" ] || { echo can not read file "$FLAC" >&1 ; exit 1 ; } ;
metaflac --export-tags-to=- "$FLAC" | sed 's/=(.*)/="1"/' >tmp.tmp
[Code].....
And I need it to run it from outside of a directory for several directories.
I need to run it from /dir for /dir/dire*
Im new to linux Iam pursuing bachelors in computer science engineering.... my final year project is to develop a "html to pdf converter using linux"... i have some basic knowledge of commands used in unix
1) Where can i get the basic idea about the existing converters... their pros and cons...
.... programming...
2) Any kind of material or source where i can get basic idea of programming used for converting html pages that are linked into a single pdf..
I bet this is a Perl one-liner (or very simple python script).I have a tab separated files in which each row looks like:Unique_Eight_Character_Sequence [3 tabs] data1~moredata1~moredata1 [3 tabs] data2~ moredata2~ moredata2 ... dataN~.The output file should have each column converted into a row (with the unique character sequence copied in for the first column), and then each "~" replaced by a comma.
View 14 Replies View RelatedHow does one convert from DD/MM/YYYY to YYYYMMDD?
Code:
06/06/2011
06/06/2011
to
Code:
20110606
20110606
convert string to long ?
View 4 Replies View Relatedi was able to use XGetImage to get an image from desktop on my Linux, not the problem is that, can i use this output XImage and convert it to png? or even save this XImage to file and load it to XImage again later?
View 3 Replies View RelatedSomeone know how i can convert from hex string to double in c/c++?? Example 40668472B020C49C is 180.139
reference page: http://babbage.cs.qc.edu/IEEE-754/64bit.html