gdunlap/sched-sim.hg

annotate simulator.c @ 3:d957708efa86

Fix some simulator bugs, mostly dealing with events happening at the same time
author George Dunlap <gdunlap@xensource.com>
date Mon Oct 19 20:11:33 2009 +0100 (2009-10-19)
parents 1d7310217c5a
children 18f3d6e25ffc
rev   line source
gdunlap@0 1 #include <stdlib.h>
gdunlap@0 2 #include <stdio.h>
gdunlap@0 3 #include <assert.h>
gdunlap@0 4
gdunlap@0 5 #define ASSERT assert
gdunlap@0 6
gdunlap@0 7 #include "stats.h"
gdunlap@0 8 #include "list.h"
gdunlap@0 9 #include "sim.h"
gdunlap@0 10 #include "workload.h"
gdunlap@2 11 #include "sched.h"
gdunlap@2 12 #include "options.h"
gdunlap@0 13
gdunlap@0 14 FILE *warn;
gdunlap@0 15
gdunlap@0 16 enum event_type {
gdunlap@0 17 EVT_BLOCK,
gdunlap@0 18 EVT_WAKE,
gdunlap@0 19 EVT_TIMER,
gdunlap@0 20 EVT_MAX
gdunlap@0 21 };
gdunlap@0 22
gdunlap@0 23 char *event_name[EVT_MAX] = {
gdunlap@0 24 [EVT_BLOCK]="block",
gdunlap@0 25 [EVT_WAKE] ="wake ",
gdunlap@0 26 [EVT_TIMER]="timer"
gdunlap@0 27 };
gdunlap@0 28
gdunlap@0 29 struct event {
gdunlap@0 30 struct list_head event_list;
gdunlap@0 31 enum event_type type;
gdunlap@0 32 int time;
gdunlap@0 33 int param; /* Usually VM ID */
gdunlap@0 34 };
gdunlap@0 35
gdunlap@0 36 char * state_name[STATE_MAX] = {
gdunlap@0 37 [STATE_RUN]= "run ",
gdunlap@0 38 [STATE_PREEMPT]="preempt",
gdunlap@0 39 [STATE_WAKE]= "wake ",
gdunlap@0 40 [STATE_BLOCK]= "block ",
gdunlap@0 41 };
gdunlap@0 42
gdunlap@0 43 struct {
gdunlap@0 44 int now;
gdunlap@0 45 struct list_head events;
gdunlap@0 46 struct list_head *timer;
gdunlap@0 47 const struct sched_ops *sched_ops;
gdunlap@0 48 } sim;
gdunlap@0 49
gdunlap@0 50
gdunlap@1 51 #ifndef VM_DATA_PUBLIC
gdunlap@1 52 struct global_vm_data {
gdunlap@0 53 int count;
gdunlap@0 54 struct vm vms[MAX_VMS];
gdunlap@1 55 };
gdunlap@1 56 #endif
gdunlap@1 57 struct global_vm_data V;
gdunlap@0 58
gdunlap@0 59 extern struct scheduler sched_rr;
gdunlap@0 60 int default_scheduler = 0;
gdunlap@0 61 struct scheduler *schedulers[] =
gdunlap@0 62 {
gdunlap@0 63 &sched_rr,
gdunlap@2 64 NULL
gdunlap@0 65 };
gdunlap@0 66
gdunlap@0 67 /* Options */
gdunlap@0 68
gdunlap@0 69 struct global_pcpu_data P;
gdunlap@0 70
gdunlap@0 71 /* Sim list interface */
gdunlap@0 72 /* NB: Caller must free if they're not going to use it! */
gdunlap@0 73 #define list_event(_l) (list_entry((_l), struct event, event_list))
gdunlap@0 74
gdunlap@0 75 struct event* sim_remove_event(int type, int param)
gdunlap@0 76 {
gdunlap@0 77 struct event* ret = NULL;
gdunlap@0 78 struct list_head *pos, *tmp;
gdunlap@0 79
gdunlap@0 80 /* Look for an event that matches this one and remove it */
gdunlap@0 81 list_for_each_safe(pos, tmp, &sim.events)
gdunlap@0 82 {
gdunlap@0 83 struct event *tevt = list_event(pos);
gdunlap@0 84 if ( tevt->type == type
gdunlap@0 85 && tevt->param == param )
gdunlap@0 86 {
gdunlap@0 87 list_del(pos);
gdunlap@0 88 ret = tevt;
gdunlap@0 89 break;
gdunlap@0 90 }
gdunlap@0 91 }
gdunlap@0 92
gdunlap@0 93 return ret;
gdunlap@0 94 }
gdunlap@0 95
gdunlap@0 96 void sim_insert_event(int time, int type, int param, int reset)
gdunlap@0 97 {
gdunlap@0 98 struct list_head *pos = NULL;
gdunlap@0 99 struct event *evt=NULL;
gdunlap@0 100
gdunlap@0 101 ASSERT(time >= sim.now);
gdunlap@0 102
gdunlap@0 103 if ( reset )
gdunlap@0 104 evt=sim_remove_event(type, param);
gdunlap@0 105
gdunlap@0 106 if ( !evt )
gdunlap@0 107 evt = (struct event *)malloc(sizeof(*evt));
gdunlap@0 108
gdunlap@0 109 evt->time = time;
gdunlap@0 110 evt->type = type;
gdunlap@0 111 evt->param = param;
gdunlap@0 112
gdunlap@1 113 printf(" [insert t%d %s param%d]\n",
gdunlap@1 114 evt->time, event_name[evt->type], evt->param);
gdunlap@1 115
gdunlap@0 116 INIT_LIST_HEAD(&evt->event_list);
gdunlap@0 117
gdunlap@0 118 list_for_each(pos, &sim.events)
gdunlap@0 119 {
gdunlap@0 120 if ( list_event(pos)->time > evt->time )
gdunlap@0 121 break;
gdunlap@0 122 }
gdunlap@0 123 list_add_tail(&evt->event_list, pos);
gdunlap@0 124 }
gdunlap@0 125
gdunlap@0 126 struct event sim_next_event(void)
gdunlap@0 127 {
gdunlap@0 128 struct event *evt;
gdunlap@0 129 struct list_head *next;
gdunlap@0 130
gdunlap@0 131 ASSERT(!list_empty(&sim.events));
gdunlap@0 132
gdunlap@0 133 next=sim.events.next;
gdunlap@0 134
gdunlap@0 135 list_del(next);
gdunlap@0 136
gdunlap@0 137 evt=list_event(next);
gdunlap@0 138
gdunlap@0 139 printf("%d: evt %s param%d\n",
gdunlap@0 140 evt->time, event_name[evt->type], evt->param);
gdunlap@0 141
gdunlap@0 142 free(evt);
gdunlap@0 143
gdunlap@0 144 /* XXX */
gdunlap@0 145 return *evt;
gdunlap@0 146 }
gdunlap@0 147
gdunlap@0 148 /*
gdunlap@0 149 * VM simulation
gdunlap@0 150 */
gdunlap@0 151 void vm_next_event(struct vm *v)
gdunlap@0 152 {
gdunlap@0 153 v->phase_index = ( v->phase_index + 1 ) % v->workload->phase_count;
gdunlap@0 154
gdunlap@0 155 v->e = v->workload->list + v->phase_index;
gdunlap@0 156 }
gdunlap@0 157
gdunlap@0 158 struct vm* vm_from_vid(int vid)
gdunlap@0 159 {
gdunlap@1 160 if ( vid >= V.count )
gdunlap@1 161 {
gdunlap@1 162 fprintf(stderr, "%s: v%d >= V.count %d!\n",
gdunlap@1 163 __func__, vid, V.count);
gdunlap@1 164 exit(1);
gdunlap@1 165 }
gdunlap@0 166
gdunlap@0 167 return V.vms + vid;
gdunlap@0 168 }
gdunlap@0 169
gdunlap@0 170 void vm_block(int now, struct vm *v)
gdunlap@0 171 {
gdunlap@0 172 ASSERT(v->e->type == PHASE_RUN);
gdunlap@0 173 v->time_this_phase += now - v->state_start_time;
gdunlap@3 174 printf("%s: v%d time_this_phase %d (evt %d)\n",
gdunlap@3 175 __func__, v->vid, v->time_this_phase, v->e->time);
gdunlap@0 176
gdunlap@0 177 ASSERT(v->time_this_phase == v->e->time);
gdunlap@0 178
gdunlap@0 179 vm_next_event(v);
gdunlap@0 180
gdunlap@0 181 ASSERT(v->e->type == PHASE_BLOCK);
gdunlap@0 182
gdunlap@0 183 sim_insert_event(now + v->e->time, EVT_WAKE, v->vid, 0);
gdunlap@0 184 v->time_this_phase = 0;
gdunlap@0 185 v->was_preempted = 0;
gdunlap@0 186 }
gdunlap@0 187
gdunlap@0 188 /* Called when wake event happens; increment timer and reset state */
gdunlap@0 189 void vm_wake(int now, struct vm *v)
gdunlap@0 190 {
gdunlap@0 191 ASSERT(v->e->type == PHASE_BLOCK);
gdunlap@0 192 ASSERT(v->time_this_phase == 0);
gdunlap@0 193
gdunlap@0 194 v->time_this_phase = now - v->state_start_time;
gdunlap@0 195
gdunlap@0 196 if ( now != 0 )
gdunlap@0 197 ASSERT(v->time_this_phase == v->e->time);
gdunlap@0 198
gdunlap@0 199 vm_next_event(v);
gdunlap@0 200
gdunlap@0 201 v->time_this_phase = 0;
gdunlap@0 202 }
gdunlap@0 203
gdunlap@0 204 /* Called when actually starting to run; make block event and set state */
gdunlap@0 205 void vm_run(int now, struct vm *v)
gdunlap@0 206 {
gdunlap@0 207 ASSERT(v->e->type == PHASE_RUN);
gdunlap@3 208 ASSERT(v->time_this_phase <= v->e->time);
gdunlap@0 209
gdunlap@0 210 sim_insert_event(now + v->e->time - v->time_this_phase, EVT_BLOCK, v->vid, 0);
gdunlap@0 211 v->state_start_time = now;
gdunlap@0 212 }
gdunlap@0 213
gdunlap@0 214 /* Preempt: Remove block event, update amount of runtime (so that when it runs again we can accurately
gdunlap@0 215 * generate a new block event) */
gdunlap@0 216 void vm_preempt(int now, struct vm *v)
gdunlap@0 217 {
gdunlap@0 218 struct event* evt;
gdunlap@0 219
gdunlap@3 220 v->time_this_phase += now - v->state_start_time;
gdunlap@3 221 printf("%s: v%d time_this_phase %d (evt %d)\n",
gdunlap@3 222 __func__, v->vid, v->time_this_phase, v->e->time);
gdunlap@3 223
gdunlap@3 224 ASSERT( v->time_this_phase <= v->e->time );
gdunlap@3 225
gdunlap@3 226 /* Only remove block event if we still have more runtime left */
gdunlap@0 227 if ( ( evt = sim_remove_event(EVT_BLOCK, v->vid) ) )
gdunlap@0 228 free(evt);
gdunlap@0 229
gdunlap@0 230 v->was_preempted = 1;
gdunlap@0 231 }
gdunlap@0 232
gdunlap@0 233
gdunlap@0 234 /* Callbacks the scheduler may make */
gdunlap@0 235 void sim_sched_timer(int time, int pid)
gdunlap@0 236 {
gdunlap@3 237 if ( time < 0 )
gdunlap@3 238 {
gdunlap@3 239 fprintf(stderr, "%s: Time %d < 0!\n",
gdunlap@3 240 __func__, time);
gdunlap@3 241 abort();
gdunlap@3 242 }
gdunlap@3 243
gdunlap@1 244 if ( pid >= P.count )
gdunlap@1 245 {
gdunlap@1 246 fprintf(stderr, "%s: p%d >= P.count %d\n",
gdunlap@1 247 __func__, pid, P.count);
gdunlap@1 248 exit(1);
gdunlap@1 249 }
gdunlap@1 250
gdunlap@1 251 if ( P.pcpus[pid].idle )
gdunlap@1 252 {
gdunlap@1 253 P.pcpus[pid].idle = 0;
gdunlap@1 254 P.idle--;
gdunlap@1 255 }
gdunlap@0 256 sim_insert_event(sim.now + time, EVT_TIMER, pid, 1);
gdunlap@0 257 }
gdunlap@0 258
gdunlap@0 259 void sim_runstate_change(int now, struct vm *v, int new_runstate)
gdunlap@0 260 {
gdunlap@0 261 int ostate, nstate;
gdunlap@0 262 int stime = now - v->state_start_time;
gdunlap@0 263
gdunlap@0 264 /* Valid transitions:
gdunlap@0 265 * + R->A (preemption): remove block event
gdunlap@0 266 * + R->B (block) : Insert wake event
gdunlap@0 267 * + A->R (run) : Insert block event
gdunlap@0 268 * + B->A (wake) : No action necessary
gdunlap@0 269 */
gdunlap@0 270
gdunlap@0 271 switch ( v->runstate )
gdunlap@0 272 {
gdunlap@0 273 case RUNSTATE_RUNNING:
gdunlap@0 274 ostate = STATE_RUN;
gdunlap@0 275 break;
gdunlap@0 276 case RUNSTATE_RUNNABLE:
gdunlap@0 277 if ( v->was_preempted )
gdunlap@0 278 ostate = STATE_PREEMPT;
gdunlap@0 279 else
gdunlap@0 280 ostate = STATE_WAKE;
gdunlap@0 281 break;
gdunlap@0 282 case RUNSTATE_BLOCKED:
gdunlap@0 283 ostate = STATE_BLOCK;
gdunlap@0 284 break;
gdunlap@0 285 }
gdunlap@0 286
gdunlap@0 287 update_cycles(&v->stats.state[ostate], stime);
gdunlap@0 288
gdunlap@0 289
gdunlap@0 290 if ( v->runstate == RUNSTATE_RUNNING
gdunlap@0 291 && new_runstate == RUNSTATE_RUNNABLE )
gdunlap@0 292 {
gdunlap@0 293 nstate = STATE_PREEMPT;
gdunlap@0 294 vm_preempt(now, v);
gdunlap@0 295 }
gdunlap@0 296 else if ( v->runstate == RUNSTATE_RUNNING
gdunlap@0 297 && new_runstate == RUNSTATE_BLOCKED )
gdunlap@0 298 {
gdunlap@0 299 nstate = STATE_BLOCK;
gdunlap@0 300 vm_block(now, v);
gdunlap@0 301 }
gdunlap@0 302 else if ( v->runstate == RUNSTATE_RUNNABLE
gdunlap@0 303 && new_runstate == RUNSTATE_RUNNING )
gdunlap@0 304 {
gdunlap@0 305 nstate = STATE_RUN;
gdunlap@0 306 vm_run(now, v);
gdunlap@0 307 }
gdunlap@0 308 else if ( v->runstate == RUNSTATE_BLOCKED
gdunlap@0 309 && new_runstate == RUNSTATE_RUNNABLE )
gdunlap@0 310 {
gdunlap@0 311 nstate = STATE_WAKE;
gdunlap@0 312 vm_wake(now, v);
gdunlap@0 313 }
gdunlap@0 314 else
gdunlap@0 315 goto unexpected_transition;
gdunlap@0 316
gdunlap@0 317 printf("%d: v%d %s %d -> %s\n",
gdunlap@0 318 now, v->vid, state_name[ostate], stime, state_name[nstate]);
gdunlap@0 319
gdunlap@0 320 v->runstate = new_runstate;
gdunlap@0 321 v->state_start_time = now;
gdunlap@0 322
gdunlap@0 323 return;
gdunlap@0 324
gdunlap@0 325 unexpected_transition:
gdunlap@0 326 fprintf(stderr, "Unexpected transition for vm %d: %d->%d\n",
gdunlap@0 327 v->vid,
gdunlap@0 328 v->runstate,
gdunlap@0 329 new_runstate);
gdunlap@0 330 exit(1);
gdunlap@0 331 }
gdunlap@0 332
gdunlap@0 333 /*
gdunlap@0 334 * Main loop
gdunlap@0 335 */
gdunlap@0 336 void simulate(void)
gdunlap@0 337 {
gdunlap@0 338 while ( sim.now < opt.time_limit )
gdunlap@0 339 {
gdunlap@0 340 /* Take next event off list */
gdunlap@0 341 struct event evt;
gdunlap@0 342
gdunlap@0 343 evt = sim_next_event();
gdunlap@0 344
gdunlap@0 345 sim.now = evt.time;
gdunlap@0 346
gdunlap@0 347 switch(evt.type)
gdunlap@0 348 {
gdunlap@0 349 case EVT_WAKE:
gdunlap@0 350 {
gdunlap@0 351 struct vm *v = vm_from_vid(evt.param);
gdunlap@0 352 ASSERT(v->processor == -1);
gdunlap@0 353 sim_runstate_change(sim.now, v, RUNSTATE_RUNNABLE);
gdunlap@2 354 sim.sched_ops->wake(sim.now, v->vid);
gdunlap@0 355 }
gdunlap@0 356 break;
gdunlap@0 357 case EVT_BLOCK:
gdunlap@0 358 {
gdunlap@0 359 struct vm *v = vm_from_vid(evt.param);
gdunlap@0 360
gdunlap@0 361 ASSERT(v->processor != -1);
gdunlap@0 362 ASSERT(v->processor <= P.count);
gdunlap@0 363
gdunlap@0 364 sim_runstate_change(sim.now, v, RUNSTATE_BLOCKED);
gdunlap@0 365
gdunlap@0 366 evt.param = v->processor; /* FIXME */
gdunlap@0 367 }
gdunlap@0 368 /* FALL-THRU */
gdunlap@0 369 case EVT_TIMER:
gdunlap@0 370 {
gdunlap@0 371 struct vm *prev, *next;
gdunlap@0 372 int pid = evt.param;
gdunlap@0 373
gdunlap@0 374 ASSERT(pid < P.count);
gdunlap@0 375
gdunlap@0 376 prev = P.pcpus[pid].current;
gdunlap@0 377
gdunlap@0 378 next = sim.sched_ops->schedule(sim.now, pid);
gdunlap@0 379
gdunlap@0 380 if ( prev && prev != next )
gdunlap@0 381 {
gdunlap@0 382 prev->processor = -1;
gdunlap@0 383 if( prev->runstate != RUNSTATE_BLOCKED )
gdunlap@0 384 sim_runstate_change(sim.now, prev, RUNSTATE_RUNNABLE);
gdunlap@0 385 }
gdunlap@0 386
gdunlap@1 387
gdunlap@0 388 P.pcpus[pid].current = next;
gdunlap@1 389 if ( next )
gdunlap@1 390 {
gdunlap@1 391 if ( next != prev )
gdunlap@1 392 {
gdunlap@1 393 sim_runstate_change(sim.now, next, RUNSTATE_RUNNING);
gdunlap@1 394 next->processor = pid;
gdunlap@1 395 }
gdunlap@1 396 }
gdunlap@3 397 else
gdunlap@1 398 {
gdunlap@3 399 if ( P.pcpus[pid].idle )
gdunlap@3 400 {
gdunlap@3 401 fprintf(stderr, "Strange, pid %d already idle!\n",
gdunlap@3 402 pid);
gdunlap@3 403 abort();
gdunlap@3 404 }
gdunlap@3 405
gdunlap@3 406 /* If the pcpu is going idle, clear all timers from it */
gdunlap@3 407 sim_remove_event(EVT_TIMER, pid);
gdunlap@3 408
gdunlap@1 409 P.pcpus[pid].idle = 1;
gdunlap@1 410 P.idle++;
gdunlap@1 411 }
gdunlap@0 412 }
gdunlap@0 413 break;
gdunlap@0 414 default:
gdunlap@0 415 fprintf(stderr, "Unexpected event type: %d\n", evt.type);
gdunlap@0 416 exit(1);
gdunlap@0 417 break;
gdunlap@0 418 }
gdunlap@0 419 }
gdunlap@0 420 }
gdunlap@0 421
gdunlap@0 422 void init(void)
gdunlap@0 423 {
gdunlap@0 424 int vid, i;
gdunlap@0 425 const struct workload *w;
gdunlap@0 426
gdunlap@0 427 /* Initialize simulation variables */
gdunlap@0 428 sim.now=0;
gdunlap@0 429 sim.timer=NULL;
gdunlap@0 430 INIT_LIST_HEAD(&sim.events);
gdunlap@0 431 sim.sched_ops = &opt.scheduler->ops;
gdunlap@0 432
gdunlap@0 433 /* Initialize pcpus */
gdunlap@0 434 P.count = opt.pcpu_count;
gdunlap@1 435 P.idle = 0;
gdunlap@0 436 for ( i=0; i<P.count; i++ )
gdunlap@0 437 {
gdunlap@0 438 P.pcpus[i].pid = i;
gdunlap@1 439 P.pcpus[i].idle = 1;
gdunlap@1 440 P.idle++;
gdunlap@0 441 P.pcpus[i].current = NULL;
gdunlap@0 442 }
gdunlap@0 443
gdunlap@0 444 /* Initialize scheduler */
gdunlap@0 445 sim.sched_ops->sched_init();
gdunlap@0 446
gdunlap@0 447 /* Initialize vms */
gdunlap@0 448 w=opt.workload;
gdunlap@1 449 V.count = 0;
gdunlap@0 450 for ( vid=0; vid<w->vm_count; vid++)
gdunlap@0 451 {
gdunlap@0 452 struct vm *v = V.vms+vid;
gdunlap@0 453
gdunlap@0 454 v->vid = vid;
gdunlap@0 455 v->runstate = RUNSTATE_BLOCKED;
gdunlap@0 456 v->processor = -1;
gdunlap@0 457 v->private = NULL;
gdunlap@0 458
gdunlap@0 459 v->state_start_time = 0;
gdunlap@0 460 v->time_this_phase = 0;
gdunlap@0 461
gdunlap@0 462
gdunlap@0 463 v->phase_index = -1;
gdunlap@0 464 v->e = NULL;
gdunlap@0 465 v->workload = w->vm_workloads+vid;
gdunlap@0 466
gdunlap@0 467 V.count++;
gdunlap@0 468
gdunlap@0 469 sim.sched_ops->vm_init(vid);
gdunlap@0 470 }
gdunlap@0 471
gdunlap@0 472 /* Set VM starting conditions */
gdunlap@0 473 for ( vid=0; vid<V.count; vid++)
gdunlap@0 474 {
gdunlap@0 475 struct vm *v = V.vms+vid;
gdunlap@0 476
gdunlap@0 477 switch(v->workload->list[0].type)
gdunlap@0 478 {
gdunlap@0 479 case PHASE_RUN:
gdunlap@0 480 v->phase_index = v->workload->phase_count - 1;
gdunlap@0 481 v->e = v->workload->list + v->phase_index;
gdunlap@0 482
gdunlap@0 483 sim_insert_event(sim.now, EVT_WAKE, v->vid, 0);
gdunlap@0 484 v->state_start_time = sim.now;
gdunlap@0 485 v->time_this_phase = 0;
gdunlap@0 486 break;
gdunlap@0 487 case PHASE_BLOCK:
gdunlap@0 488 v->phase_index = 0;
gdunlap@0 489 v->e = v->workload->list;
gdunlap@0 490
gdunlap@0 491 sim_insert_event(sim.now + v->e->time, EVT_WAKE, v->vid, 0);
gdunlap@0 492 v->state_start_time = sim.now;
gdunlap@0 493 v->time_this_phase = 0;
gdunlap@0 494 break;
gdunlap@0 495 }
gdunlap@0 496 }
gdunlap@0 497 }
gdunlap@0 498
gdunlap@0 499 void report(void)
gdunlap@0 500 {
gdunlap@0 501 int i, j;
gdunlap@0 502
gdunlap@0 503 for ( i=0; i<V.count; i++ )
gdunlap@0 504 {
gdunlap@0 505 struct vm *v = V.vms + i;
gdunlap@0 506
gdunlap@0 507 printf("VM %d\n", i);
gdunlap@0 508 for ( j = 0; j < STATE_MAX ; j++ )
gdunlap@0 509 {
gdunlap@0 510 char s[128];
gdunlap@0 511 snprintf(s, 128, " %s", state_name[j]);
gdunlap@0 512 print_cycle_summary(&v->stats.state[j], sim.now, s);
gdunlap@0 513 }
gdunlap@0 514 }
gdunlap@0 515 }
gdunlap@0 516
gdunlap@0 517 int main(int argc, char * argv[])
gdunlap@0 518 {
gdunlap@0 519 warn = stdout;
gdunlap@0 520
gdunlap@2 521 parse_options(argc, argv);
gdunlap@0 522
gdunlap@0 523 /* Setup simulation */
gdunlap@0 524 init();
gdunlap@0 525
gdunlap@0 526 /* Run simulation */
gdunlap@0 527 simulate();
gdunlap@0 528 /* Report statistics */
gdunlap@0 529 report();
gdunlap@0 530 }