IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37059


Ignore:
Timestamp:
Jul 17, 2014, 11:51:53 AM (12 years ago)
Author:
eugene
Message:

minor changes to PclientCommand for debugging

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tags/ipp-20130712/Ohana/src/opihi/pcontrol/PclientCommand.c

    r27435 r37059  
    2525    return (PCLIENT_DOWN);
    2626  }
    27  
     27
    2828  // prepare host to accept response
    2929  host[0].response_state = response_state;
     
    3535  return (PCLIENT_GOOD);
    3636}
    37  
     37
     38# define MARKTIME(MSG,...) {                    \
     39    gettimeofday (&stopTimer, (void *) NULL);   \
     40    float dtime = DTIME (stopTimer, startTimer);        \
     41    fprintf (stderr, MSG, __VA_ARGS__); }
     42
     43# define INITTIME \
     44  struct timeval startTimer, stopTimer; \
     45  gettimeofday (&startTimer, (void *) NULL);
     46
    3847// check for response; message must end with specified string.
    3948// accumulate the response in the buffer
     
    4756  ASSERT (response != NULL, "response missing");
    4857  ASSERT (buffer != NULL, "buffer missing");
     58
     59  // INITTIME;
    4960
    5061  /* avoid blocking very long on read, test every 100 usec, up to 0.1 sec */
     
    6677    return (PCLIENT_DOWN);
    6778  }
    68   if (line == NULL) return (PCLIENT_HUNG);
    69   if (status == -1) return (PCLIENT_HUNG);
     79  if (line == NULL) {
     80      // MARKTIME ("-- client hung (line NULL): %s : %f sec\n", host[0].hostname, dtime);
     81      return (PCLIENT_HUNG);
     82  }
     83  if (status == -1) {
     84      // MARKTIME ("-- client hung (status -1): %s : %f sec\n", host[0].hostname, dtime);
     85      return (PCLIENT_HUNG);
     86  }
    7087
    7188  // fprintf (stderr, "response: %s\n", buffer[0].buffer);
     
    7592
    7693/* memstr returns a view, not an allocated string : don't free */
    77 /* ReadtoIOBuffer returns : 
     94/* ReadtoIOBuffer returns :
    7895    0 - pipe closed
    7996   -1 - no more data in pipe, data not ready
Note: See TracChangeset for help on using the changeset viewer.