Changeset 2846 for trunk


Ignore:
Timestamp:
Jan 24, 2013, 7:35:19 PM (6 years ago)
Author:
ksherdy
Message:

Added desc to PERF_SEC_BIND.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/perflib/perfsec.h

    r2828 r2846  
    1515  #include <sched.h>
    1616
    17   static inline int set_processor_affinity(unsigned long mask) { // mask = 1 sets hard processor affinity for core 1, mask = 2 for core 2, mask = 4 for core 3, mask = 7 for core 1 and core 2 and core 3.
     17  /* mask - Bit mask.
     18
     19     mask = 2^0 = 1 core 1
     20     mask = 2^1 = 2 core 2
     21     ...
     22     mask = 2^7 = 128 core 8
     23
     24     mask = (2^0 | 2^1) = 3 core 1 or core 2
     25  */
     26
     27  static inline int set_processor_affinity(unsigned long mask) {
     28
    1829
    1930    unsigned int len = sizeof(mask);
    2031
    2132    if (sched_setaffinity(0, len, (const cpu_set_t *)&mask) < 0) {
    22       //printf("sched_setaffinity call failed.\n");
     33      printf("sched_setaffinity call failed.\n");
    2334      return -1;
    2435    }
    2536
    26     //printf("CPU affinity mask: %08lx\n", mask);
     37    printf("Set CPU affinity mask: %08lx\n", mask);
    2738
    2839    return 0;
     
    4051
    4152        if(0 == SetProcessAffinityMask(hProcess, mask)) {
    42           // printf("SetProcessAffinityMask call failed.\n");
     53              printf("SetProcessAffinityMask call failed.\n");
    4354              return -1;
    4455        }
    4556
    46     // printf("CPU affinity mask: %08lx\n", mask);
     57        printf("CPU affinity mask: %08lx\n", mask);
    4758
    4859        return 0;
     
    5970
    6071#define PERF_SEC_BIND(mask) \
    61         set_processor_affinity(mask)
     72        set_processor_affinity(mask);
    6273
    6374#if defined(WALL_TIMING)
     
    160171
    161172        #define PERF_SEC_WRITE(timer) \
    162                 timer->write_xml_file() \
     173                timer->write_xml_file(); \
     174                timer->write_csv_file()
    163175               
    164176        #define PERF_SEC_DESTROY(timer) \
Note: See TracChangeset for help on using the changeset viewer.