ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/BioCocoa/BioSwarm/trunk/Models/BioSwarmModel.m
(Generate patch)
# Line 1219 | Line 1219
1219  
1220    return roundUp;
1221   }
1222 +
1223 + //
1224 + // Simple profiling function
1225 + //
1226 +
1227 + static time_t bc_profile_time = 0;
1228 +
1229 + void bc_record_time(const char *msg)
1230 + {
1231 +  time_t delta = 0;
1232 +  time_t current = time(NULL);
1233 +
1234 +  if (!bc_profile_time) {
1235 +    bc_profile_time = time(NULL);
1236 +    current = bc_profile_time;
1237 +  } else {
1238 +    delta = current - bc_profile_time;
1239 +    bc_profile_time = current;
1240 +  }
1241 +
1242 +  printf("TIME: (%d secs elapsed) %s, %s", delta, msg, asctime(localtime(&bc_profile_time)));
1243 + }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines