cpu-speed

Machine code alignment

三世轮回 提交于 2019-12-12 08:55:11
问题 I am trying to understand the principles of machine code alignment. I have an assembler implementation which can generate machine code in run-time. I use 16-bytes alignment on every branch destination, but looks like it is not the optimal choice, since I've noticed that if I remove alignment than sometimes same code works faster. I think that something to do with cache line width, so that some commands are cut by a cache line and CPU experiences stalls because of that. So if some bytes of

Exactly how “fast” are modern CPUs?

夙愿已清 提交于 2019-12-12 07:08:42
问题 When I used to program embedded systems and early 8/16-bit PCs (6502, 68K, 8086) I had a pretty good handle on exacly how long (in nanoseconds or microseconds) each instruction took to execute. Depending on family, one (or four) cycles equated to one "memory fetch", and without caches to worry about, you could guess timings based on the number of memory accesses involved. But with modern CPU's, I'm confused. I know they're a lot faster, but I also know that the headline gigahertz speed isn't

How to calculate and print clock_t time roughly

偶尔善良 提交于 2019-12-11 13:36:15
问题 I am timing how long it takes to do three different types of searches, sequential, recursive binary, and iterative binary. I have those in place, and it does iterate through and finish the search. My problem is that when I time them all, I get 0 for all of them every time, even if I make an array of 100,000, and I have it search for something not in the array. If I set a break point in the search it obviously makes the time longer, and it gives me a reasonable time that I can work with. But

Animation speed on different devices

☆樱花仙子☆ 提交于 2019-12-10 00:40:48
问题 I have a simple translation animation in an Android game I am developing. When I test it on several devices, it runs at very different speeds on 10-inch tablets, 7-inch tablets and smartphones. What is the "state of the art" way of getting a uniform animation speed on different devices? Thanks, 回答1: I finally decided to use display.metrics to get the pixel density of the devices. Then I adjust the translation motion speed by dividing by the density value. Still wondering if this is the "state

How to check CPU name, model, speed on Windows/Linux C?

六眼飞鱼酱① 提交于 2019-12-08 06:40:32
问题 I would like to get some infos with C about hardware: how many CPU's I have how many cores have each of them how many logical cores have every core in every CPU CPU name + model CPU speed + frequency CPU architecture (x86, x64) I know that on Linux-like OS I can parse /proc/cpuinfo but since its not an ordinary file, I think its unsafe. Saw this answer on SO but it doesnt give me EVERY info I need. Should I call cat /proc/cpuinfo > file.txt and then parse file.txt ? I know about cpuid.h (Im

Why cpu bound is better with blocking I/O and I/O bound is better with non blocking I/O

点点圈 提交于 2019-12-07 01:45:33
问题 I have been told that for I/O bound applications, non blocking I/O would be better. For CPU bound applications, blocking I/O is much better. I could not find the reason for such a statement. Tried google, but few articles just touches the topic with not much details. Can someone provide the deep depth reason for it? With this, I want to clear myself with what are the short coming of non blocking I/O as well. After going through another thread here,a reason I could relate was out was if the I

Why cpu bound is better with blocking I/O and I/O bound is better with non blocking I/O

和自甴很熟 提交于 2019-12-05 04:42:47
I have been told that for I/O bound applications, non blocking I/O would be better. For CPU bound applications, blocking I/O is much better. I could not find the reason for such a statement. Tried google, but few articles just touches the topic with not much details. Can someone provide the deep depth reason for it? With this, I want to clear myself with what are the short coming of non blocking I/O as well. After going through another thread here ,a reason I could relate was out was if the I/O process is heavy enough then only we can see significant performance improvements using non blocking

Animation speed on different devices

本小妞迷上赌 提交于 2019-12-04 23:16:55
I have a simple translation animation in an Android game I am developing. When I test it on several devices, it runs at very different speeds on 10-inch tablets, 7-inch tablets and smartphones. What is the "state of the art" way of getting a uniform animation speed on different devices? Thanks, I finally decided to use display.metrics to get the pixel density of the devices. Then I adjust the translation motion speed by dividing by the density value. Still wondering if this is the "state of the art" way of controlling animation speed on various devices??? Animation duration should be same on

Locking the CPU on android for app performance testing

与世无争的帅哥 提交于 2019-12-04 14:26:19
问题 I'm trying to test an app's performance on android at different CPU states. So i will like to lock the CPU at say 1000Mhz and take readings and then overload the CPU and take readings. My question is: Is there anyway to lock the CPU and possibly the RAM at certain lock/freeze rates?? Any link to documentations on this will be highly appreciated. 回答1: Follow these steps(all steps with root privilege): 1. stop mpdecision 2. In /sys/devices/system/cpu you can see how many cores in your device,

Locking the CPU on android for app performance testing

笑着哭i 提交于 2019-12-03 09:05:52
I'm trying to test an app's performance on android at different CPU states. So i will like to lock the CPU at say 1000Mhz and take readings and then overload the CPU and take readings. My question is: Is there anyway to lock the CPU and possibly the RAM at certain lock/freeze rates?? Any link to documentations on this will be highly appreciated. Follow these steps(all steps with root privilege): 1. stop mpdecision 2. In /sys/devices/system/cpu you can see how many cores in your device, if dual core, you will see cpu0 and cpu1 two folders. 3. write 0 or 1 to disable or enable core echo "0" >