cpu-cycles

How do I obtain CPU cycle count in Win32?

In Win32, is there any way to get a unique cpu cycle count or something similar that would be uniform for multiple processes/languages/systems/etc. I'm creating some log files, but have to produce multiple logfiles because we're hosting the .NET runtime, and I'd like to avoid calling from one to the other to log. As such, I was thinking...

How to set CPU load on a Red Hat Linux box?

I have a RHEL box that I need to put under a moderate and variable amount of CPU load (50%-75%). What is the best way to go about this? Is there a program that can do this that I am not aware of? I am happy to write some C code to make this happen, I just don't know what system calls will help. ...

Limiting assembly execution number of cpu cycles

I have a project that dynamically loads in unknown assemblies implementing a specified interface. I don't know the contents or purposes of the assembly, other than it implementing my interface. I need to somehow restrict the amount of processing power available to these assemblies. Processor priority is not what I'm looking for. I can't...

The correct way of waiting for strings to become equal

In a Swing app a method should continue only after user enters a correct answer. The correct answer is stored in a String with user answer being set by a listener to another String. So, the code is while (!correctAnswer.equals(currentAnswer)) { // wait for user to click the button with the correct answer typed into the textfiel...

Does a one cycle instruction take one cycle, even if RAM is slow?

Hi! I am using an embedded RISC processor. There is one basic thing I have a problem figuring out. The CPU manual clearly states that the instruction ld r1, [p1] (in C: r1 = *p1) takes one cycle. Size of register r1 is 32 bits. However, the memory bus is only 16 bits wide. So how can it fetch all data in one cycle? ...

Windows utility for consuming CPU

I'm looking for a windows utility to consume CPU at a specified percentage so that I can test my app under conditions of restricted processor resources. I googled around and saw a reference to CPUGRAB.exe, but can't find a download location. ...

I want to duplicate Folding (use extra cpu-cycles)

I want to use extra-cpu cycles to do some of my own processing, and I was wondering if someone could point me in the right direction as to how to get started on this? ...

Measuring CPU clocks consumed by a process

Hi, I have written a program in C. Its a program created as result of a research. I want to compute exact CPU cycles which program consumes. Exact number of cycles. Any idea how can I find that? ...

Approximate Number of CPU Cycles for Various Operations

I am trying to find a reference for approximately how many CPU cycles various operations require. I don't need exact numbers (as this is going to vary between CPUs) but I'd like something relatively credible that gives ballpark figures that I could cite in discussion with friends. As an example, we all know that floating point division...

Java controls animation - how to make them smooth and efficient

I am programming some custom controls in Java and using animation for transitions/fades/movements. The way I am doing this is that I am starting a new thread and making adjustments to variables and things are adjusted using paint() method. Example: Now, my question is, let's say for instance that I was implementing a fade in. What I w...

How does this code calculate the number of CPU cycles elapsed?

Taken from this SO thread, this piece of code calculates the number of CPU cycles elapsed running code between lines //1 and //2. $ cat cyc.c #include<stdio.h> static __inline__ unsigned long long rdtsc(void) { unsigned long long int x; __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); return x; } int main() { unsigne...