Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 2nd, 2012  |  syntax: C  |  size: 1.28 KB  |  hits: 15  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                 // MH:AZP (1 byte)
  2.                 byte pattern_count=0;
  3.                 unsigned int j;
  4.                 for (j = 0; i<MAX_PATTERNS_PER_MATRIX; i++){
  5.                         if (traced_matrices[i].access_patterns[i].length!=0){
  6.                                 pattern_count++;
  7.                         }
  8.                 }
  9.                 VG_(write) (fd, &pattern_count, sizeof(byte));
  10.  
  11. static void write_patterns(int fd, traced_matrix * matrix){
  12.         /**
  13.          * Access Pattern (ZP) 7 Byte + ZP:Len * 12 Byte
  14.          */
  15.        
  16.         unsigned int i;
  17.         for (i = 0; i<MAX_PATTERNS_PER_MATRIX; i++){
  18.                 if (matrix->access_patterns[i].length!=0){
  19.                        
  20.                         //ZP:ID
  21.                         byte id = (byte)(matrix->access_patterns[i] - matrix->access_patterns);
  22.                         VG_(write) (fd, &id, sizeof(byte));
  23.                        
  24.                         //ZP:ANZ
  25.                         VG_(write)(fd, &(matrix->access_patterns[i].occurences), sizeof(unsigned int));
  26.                        
  27.                         //ZP:LEN
  28.                         ushort len = (ushort)(matrix->access_patterns[i].length);
  29.                         VG_(write)(fd, &(len), sizeof(ushort));
  30.                        
  31.                         int k;
  32.                         for (k = 0; k < matrix->access_patterns[i].length; ++k)
  33.                         {
  34.                                 matrix_access_method accm = matrix->access_patterns[i].steps[k];
  35.  
  36.                                 // ZA:OM
  37.                                 VG_(write)(fd, &(accm.offset_m), sizeof(ushort));
  38.  
  39.                                 // ZA:ON
  40.                                 VG_(write)(fd, &(accm.offset_n), sizeof(ushort));
  41.  
  42.                                 // ZA:AH
  43.                                 VG_(write)(fd, &(accm.hits), sizeof(unsigned int));
  44.  
  45.                                 // ZA:AM
  46.                                 VG_(write)(fd, &(accm.misses), sizeof(unsigned int));
  47.                         }
  48.                 }
  49.         }
  50. }