Changeset 5703
Fix CPU binding/speed setting when doing translation timings
Comitted by:
mjagdis
Date:
Jun 04 2010 * 23:10 (about 1 year ago)
Affected files:
callweaver/trunk/corelib/translate.c (unified diff)
| r5680 | r5703 | |
|---|---|---|
| 727 | 727 | { |
| 728 | 728 | #ifdef __linux__ |
| 729 | 729 | char governor[sizeof("performance")]; |
| 730 | int governor_len; | |
| 730 | 731 | #endif |
| 731 | 732 | #if HAVE_SETAFFINITY |
| 732 | 733 | cpu_set_t old_cpuset, new_cpuset; |
| 734 | int affinity; | |
| 733 | 735 | #endif |
| 734 | 736 | pthread_mutex_t serialize = PTHREAD_MUTEX_INITIALIZER; |
| 735 | 737 | struct rebuild_matrix_args args; |
| 736 | 738 | struct trans_state *old_tr, *new_tr; |
| 737 | int affinity; | |
| 738 | 739 | int changed, x, y, z; |
| 739 | 740 | |
| 740 | 741 | if (option_debug) |
| --- | --- | |
| 793 | 794 | * fact that CPU0 could be disabled, offline or just not in our set |
| 794 | 795 | * would require root privs with the current (kernel 2.6.25) sysfs. |
| 795 | 796 | */ |
| 796 | governor[0] = '\0'; | |
| 797 | if (affinity == 0 | |
| 798 | && lseek(cw_cpu0_governor_fd, SEEK_SET, 0) == 0 | |
| 799 | && read(cw_cpu0_governor_fd, governor, sizeof(governor) - 1) > 0 | |
| 800 | && governor[strlen(governor) - 1] == '\n') { | |
| 797 | governor_len = 0; | |
| 798 | if ( | |
| 799 | #if HAVE_SETAFFINITY | |
| 800 | affinity == 0 | |
| 801 | && | |
| 802 | #endif | |
| 803 | lseek(cw_cpu0_governor_fd, SEEK_SET, 0) == 0 | |
| 804 | && (governor_len = read(cw_cpu0_governor_fd, governor, sizeof(governor) - 1)) > 0 | |
| 805 | && governor[governor_len - 1] == '\n') { | |
| 801 | 806 | lseek(cw_cpu0_governor_fd, SEEK_SET, 0); |
| 802 | 807 | write(cw_cpu0_governor_fd, "performance\n", sizeof("performance\n") - 1); |
| 803 | } else | |
| 804 | governor[0] = '\0'; | |
| 808 | } | |
| 805 | 809 | #endif |
| 806 | 810 | |
| 807 | 811 | /* Do a dummy run of each translator to grow heap/stack space appropriately |
| --- | --- | |
| 821 | 825 | |
| 822 | 826 | #ifdef __linux__ |
| 823 | 827 | /* Restore the original cpufreq governor */ |
| 824 | if (governor[0]) | |
| 825 | write(cw_cpu0_governor_fd, governor, strlen(governor)); | |
| 828 | if (governor_len > 0) | |
| 829 | write(cw_cpu0_governor_fd, governor, governor_len); | |
| 826 | 830 | #endif |
| 827 | 831 | |
| 828 | 832 | #if HAVE_SETAFFINITY |
| 829 | 833 | /* Restore the original CPU affinity */ |
| 830 | if (affinity != -1) | |
| 834 | if (affinity != CPU_SETSIZE) | |
| 831 | 835 | sched_setaffinity(0, sizeof(old_cpuset), &old_cpuset); |
| 832 | 836 | #endif |
| 833 | 837 |
![Home changeset 5703 [home]](/images/logo.png?1180520111)

RSS Feeds