<commit_before>#ifndef DRAKE_UTIL_LCMSCOPE_H_
#define DRAKE_UTIL_LCMSCOPE_H_

#include "lcmt_scope_data.h"
#include <string.h>
#include <time.h>
#include "lcm.h"

/*Utility to automate the use of our matlab scope infrastructure with C++
programs.
This code wraps the lcmt_scope_data type so you don't have get so dirty with
pointers
and adds time on the x-axis so you don't have to.

<NAME>, Aug 2010
*/
class LCMScope {
  lcmt_scope_data data;
  lcm_t* lcm;
  char* lcm_chan;
  timeval start;

 private:
  // http://www.mpp.mpg.de/~huber/util/timevaldiff.c
  long timevaldiff(struct timeval* starttime, struct timeval* finishtime) {
    long msec;
    msec = (finishtime->tv_sec - starttime->tv_sec) * 1000;
    msec += (finishtime->tv_usec - starttime->tv_usec) / 1000;
    return msec;
  }<commit_msg>Replace long with double in timevaldiff. The cpplint runtime/int hates bare 'long', and the using-code was publishing it as a double anyway.<commit_after>#ifndef DRAKE_UTIL_LCMSCOPE_H_
#define DRAKE_UTIL_LCMSCOPE_H_

#include "lcmt_scope_data.h"
#include <string.h>
#include <time.h>
#include "lcm.h"

/*Utility to automate the use of our matlab scope infrastructure with C++
programs.
This code wraps the lcmt_scope_data type so you don't have get so dirty with
pointers
and adds time on the x-axis so you don't have to.

<NAME>, Aug 2010
*/
class LCMScope {
  lcmt_scope_data data;
  lcm_t* lcm;
  char* lcm_chan;
  timeval start;

 private:
  // http://www.mpp.mpg.de/~huber/util/timevaldiff.c
  double timevaldiff(struct timeval* starttime, struct timeval* finishtime) {
    double msec;
    msec = (finishtime->tv_sec - starttime->tv_sec) * 1000.0;
    msec += (finishtime->tv_usec - starttime->tv_usec) / 1000.0;
    return msec;
  }
{'fraction_non_alphanumeric': 0.1038439472174412, 'fraction_numerical': 0.01491681009753299, 'mean_word_length': 4.099415204678363, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6848023', 'n_tokens_mistral': 700, 'n_tokens_neox': 667, 'n_words': 191}