home *** CD-ROM | disk | FTP | other *** search
/ ftp.parl.clemson.edu / 2015-02-07.ftp.parl.clemson.edu.tar / ftp.parl.clemson.edu / pub / pvfs2 / orangefs-2.8.3-20110323.tar.gz / orangefs-2.8.3-20110323.tar / orangefs / test / io / description / debug16.c < prev    next >
C/C++ Source or Header  |  2005-11-11  |  4KB  |  161 lines

  1. /*
  2.  * (C) 2002 Clemson University.
  3.  *
  4.  * See COPYING in top-level directory.
  5.  */       
  6.  
  7. #include <stdlib.h>
  8. #include <stdio.h>
  9. #include <pvfs2-types.h>
  10. #include <gossip.h>
  11. #include <pvfs2-debug.h>
  12.  
  13. #include <pint-distribution.h>
  14. #include <pint-dist-utils.h>
  15. #include <pvfs2-request.h>
  16. #include <pint-request.h>
  17. #include "pvfs2-internal.h"
  18.  
  19. #define SEGMAX 16
  20. #define BYTEMAX (4*1024*1024)
  21.  
  22. int main(int argc, char **argv)
  23. {
  24.     int i;
  25.     PINT_Request *r1a;
  26.     PINT_Request *r1;
  27.     PINT_Request *r2;
  28.     PINT_Request_state *rs1;
  29.     PINT_Request_state *rs2;
  30.     PINT_request_file_data rf1;
  31.     PINT_Request_result seg1;
  32.  
  33.     /* PVFS_Process_request arguments */
  34.     int retval;
  35.     int32_t blocklength = 24;
  36.     PVFS_size displacement = 1024;
  37.  
  38.     /* set up request state */
  39.     PVFS_Request_resized(PVFS_INT, 0, -16, &r1a);
  40.     PVFS_Request_hindexed(1, &blocklength, &displacement, r1a, &r1);
  41.     rs1 = PINT_new_request_state(r1);
  42.  
  43.     /* set up memory request */
  44.     PVFS_Request_contiguous(96, PVFS_BYTE, &r2);
  45.     rs2 = PINT_new_request_state(r2);
  46.  
  47.     /* set up file data for request */
  48.     PINT_dist_initialize(NULL);
  49.     rf1.server_nr = 0;
  50.     rf1.server_ct = 4;
  51.     rf1.fsize = 6000;
  52.     rf1.dist = PINT_dist_create("simple_stripe");
  53.     rf1.extend_flag = 0;
  54.     PINT_dist_lookup(rf1.dist);
  55.  
  56.     /* set up result struct */
  57.     seg1.offset_array = (int64_t *)malloc(SEGMAX * sizeof(int64_t));
  58.     seg1.size_array = (int64_t *)malloc(SEGMAX * sizeof(int64_t));
  59.     seg1.bytemax = BYTEMAX;
  60.     seg1.segmax = SEGMAX;
  61.     seg1.bytes = 0;
  62.     seg1.segs = 0;
  63.     
  64.     /* skip into the file datatype */
  65.     /*PINT_REQUEST_STATE_SET_TARGET(rs1, 500);*/
  66.     /*PINT_REQUEST_STATE_SET_FINAL(rs1,720);*/
  67.  
  68.    /* Turn on debugging */
  69.     // gossip_enable_stderr();
  70.     // gossip_set_debug_mask(1,GOSSIP_REQUEST_DEBUG); 
  71.  
  72.     /* skipping logical bytes */
  73.     // PINT_REQUEST_STATE_SET_TARGET(rs1,(3 * 1024) + 512);
  74.     // PINT_REQUEST_STATE_SET_FINAL(rs1,(6 * 1024) + 512);
  75.     
  76.     printf("\n************************************\n");
  77.     printf("One request in CLIENT mode size 24*4 strided -16 server 0 of 4\n");
  78.     printf("Simple stripe, default stripe size (64K)\n");
  79.     printf("Offset 0M, file size 6000, no extend flag\n");
  80.     printf("MemReq size 96 coniguous\n");
  81.     printf("\n************************************\n");
  82.     PINT_REQUEST_STATE_RESET(rs1);
  83.     PINT_REQUEST_STATE_RESET(rs2);
  84.     do
  85.     {
  86.         int r = 0;
  87.         seg1.bytes = 0;
  88.         seg1.segs = 0;
  89.  
  90.         /* process request */
  91.         retval = PINT_process_request(rs1, rs2, &rf1, &seg1, PINT_CLIENT);
  92.  
  93.         if(retval >= 0)
  94.         {
  95.             printf("results of PINT_process_request():\n");
  96.             printf("%d segments with %lld bytes\n", seg1.segs, lld(seg1.bytes));
  97.             for(i=0; i<seg1.segs; i++, r++)
  98.             {
  99.                 printf("  segment %d: offset: %d size: %d\n",
  100.                     i, (int)seg1.offset_array[i], (int)seg1.size_array[i]);
  101.             }
  102.         }
  103.  
  104.     } while(!PINT_REQUEST_DONE(rs1) && retval >= 0);
  105.     
  106.     if(retval < 0)
  107.     {
  108.         fprintf(stderr, "Error: PINT_process_request() failure.\n");
  109.         return(-1);
  110.     }
  111.     if(PINT_REQUEST_DONE(rs1))
  112.     {
  113.         printf("**** request done.\n");
  114.     }
  115.     
  116.    /* Turn on debugging */
  117.     // gossip_enable_stderr();
  118.     // gossip_set_debug_mask(1,GOSSIP_REQUEST_DEBUG); 
  119.  
  120.     printf("\n************************************\n");
  121.     printf("One request in SERVER mode size 24*4 strided -16 server 0 of 4\n");
  122.     printf("Simple stripe, default stripe size (64K)\n");
  123.     printf("Offset 0M, file size 6000, no extend flag\n");
  124.     printf("MemReq size 96 coniguous\n");
  125.     printf("\n************************************\n");
  126.     PINT_REQUEST_STATE_RESET(rs1);
  127.     do
  128.     {
  129.         int r = 0;
  130.         seg1.bytes = 0;
  131.         seg1.segs = 0;
  132.  
  133.         /* process request */
  134.         retval = PINT_process_request(rs1, NULL, &rf1, &seg1, PINT_SERVER);
  135.  
  136.         if(retval >= 0)
  137.         {
  138.             printf("results of PINT_process_request():\n");
  139.             printf("%d segments with %lld bytes\n", seg1.segs, lld(seg1.bytes));
  140.             for(i=0; i<seg1.segs; i++, r++)
  141.             {
  142.                 printf("  segment %d: offset: %d size: %d\n",
  143.                     i, (int)seg1.offset_array[i], (int)seg1.size_array[i]);
  144.             }
  145.         }
  146.  
  147.     } while(!PINT_REQUEST_DONE(rs1) && retval >= 0);
  148.     
  149.     if(retval < 0)
  150.     {
  151.         fprintf(stderr, "Error: PINT_process_request() failure.\n");
  152.         return(-1);
  153.     }
  154.     if(PINT_REQUEST_DONE(rs1))
  155.     {
  156.         printf("**** request done.\n");
  157.     }
  158.  
  159.     return 0;
  160. }
  161.