Guest User

Untitled

a guest
Mar 22nd, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. $ cat /proc/cpuinfo | grep cache_alignment
  2. $ LEVEL1_DCACHE_LINESIZE
  3.  
  4. flag: -DLEVEL1_DCACHE_LINESIZE=`getconf LEVEL1_DCACHE_LINESIZE`
  5.  
  6. #define CACHE_LINE sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
  7.  
  8. typedef struct node_t { //64 LEVEL1_DCACHE_LINESIZE
  9. unsigned char parent_sense;
  10. unsigned char* parent_pointer;
  11.  
  12. //binary wakeup tree, every processor assigned static spot, parent reach down to child to tell them to wake up
  13. unsigned char* child_pointers[2];
  14. unsigned char have_children[4];
  15. unsigned char child_not_ready[4];
  16.  
  17. unsigned char dummy;
  18.  
  19. unsigned char padding[16];
  20. } node_t; //total size must match 64 LEVEL1_DCACHE_LINESIZE
  21.  
  22. node_t* nodes;
  23. posix_memalign((void **)&nodes, CACHE_LINE, (sizeof(node_t) * num_threads)); //sysconf(_SC_LEVEL1_DCACHE_LINESIZE)
Add Comment
Please, Sign In to add comment