예제 #1
0
void create_graphs(int signum)
{
  if (signum == SIGUSR1)
  {
    log_info("Received SIGUSR1!");
    analytics();
  }
}
예제 #2
0
int main(int argc, char *argv[])
{
    char from[230000] = {'a'}; //allocates 230000 bytes with an initial of 'a' at index 0, note: have to make this big to see the difference in speed of those functions
    char to[230000] = {'c'};
    int rc = 0;
    
    // setup the from to have some stuff
    memset(from, 'x', 230000); //this seems fast, it sets all 230000 bytes to a character 'x'
    // set it to a failure mode
    memset(to, 'y', 230000);
    check(valid_copy(to, 230000, 'y'), "Not initialized right.");
    
    // use normal copy to
    rc = normal_copy(from, to, 230000);
    check(rc == 230000, "Normal copy failed: %d", rc);
    check(valid_copy(to, 230000, 'x'), "Normal copy failed.");
    
    // reset
    memset(to, 'y',230000);
    
    // duffs version
    rc = duffs_device(from, to, 230000);
    check(rc == 230000, "Duff's device failed: %d", rc);
    check(valid_copy(to, 230000, 'x'), "Duff's device failed copy.");
    
    // reset
    memset(to, 'y', 230000);
    
    // my version
    rc = zeds_device(from, to, 230000);
    check(rc == 230000, "Zed's device failed: %d", rc);
    check(valid_copy(to, 230000, 'x'), "Zed's device failed copy.");
    
    analytics(); //just prints to the console the speed data of each function
    
    return 0;
error:
    return 1;
}