@@ -338,6 +338,9 @@ int Simulator::runTraceFileGenerator(int simulationSteps){
338
338
339
339
bool Simulator::allocationRandomObjectAARD (int thread){
340
340
341
+
342
+ int percentageDone = (stepsToGo-currentStep)/(float )stepsToGo*100 ;
343
+
341
344
int outGoingRefsMax = (rand () % MAX_POINTERS) + 1 ;
342
345
int primitiveField = (rand () % MAX_PRIMITIVES) +1 ;
343
346
int rootsetSize = memManager->getRootsetSize (thread);
@@ -346,35 +349,208 @@ bool Simulator::allocationRandomObjectAARD(int thread){
346
349
347
350
348
351
int clsIndex;
349
- double weight = maxWeight*( 1.0 *rand ()/RAND_MAX);
350
- // double wieght = 40*( pow(.5, rnd) );
351
- clsIndex = (int )( logb (weight)-logb (constantValue) -1 )/(logb (slop)); // 40, 20, 10,
352
- // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
353
- clsObj = memManager->getClassObject (clsIndex);
354
352
int cnt = 0 ;
355
353
354
+ // it is good
355
+ /*
356
+ if(percentageDone<50){
356
357
358
+ double weight = maxWeight*( 1.0*rand()/RAND_MAX);
359
+ //double wieght = 40*( pow(.5, rnd) );
360
+ clsIndex = (int)( logb(weight)-logb(constantValue) -1 )/(logb(slop)); // 40, 20, 10,
361
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
362
+ clsObj = memManager->getClassObject(clsIndex);
363
+
364
+ }
365
+ else{
357
366
367
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
368
+ //double wieght = 40*( pow(.5, rnd) );
369
+ clsIndex = (int)( weight*slop ); // 40, 20, 10,
370
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
371
+ clsObj = memManager->getClassObject(clsIndex);
372
+ }
358
373
374
+ */
359
375
/*
376
+ It is also good
360
377
361
- //3.0
362
- // select an entry from class table;
363
- int clsIndex = rand()%NUM_CLAZZ;
364
- ClassObject* clsObj = memManager->getClassObject(clsIndex);
365
- // select class which has been acceessed (hit) less
366
- int cnt = 0;
367
- while(clsObj->getAccessCount()>MAXCACCESS){
368
- cnt++;
369
- clsIndex = rand()%NUM_CLAZZ;
378
+ char a;
379
+
380
+ if(percentageDone<50){
381
+
382
+ double weight = maxWeight*( 1.0*rand()/RAND_MAX);
383
+ //double wieght = 40*( pow(.5, rnd) );
384
+ clsIndex = (int)( logb(weight)-logb(constantValue) -1 )/(logb(slop)); // 40, 20, 10,
385
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
386
+ clsObj = memManager->getClassObject(clsIndex);
387
+
388
+ }
389
+ else if ( (percentageDone>=50) && (percentageDone<70) ){
390
+ //printf("50 done %d \n", percentageDone);
391
+ //scanf("%c", &a);
392
+
393
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
394
+ //double wieght = 40*( pow(.5, rnd) );
395
+ clsIndex = (int)( weight*slop ); // 40, 20, 10,
396
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
397
+ clsObj = memManager->getClassObject(clsIndex);
398
+ }
399
+ else if ( (percentageDone>=70) && (percentageDone<95) ) {
400
+ //printf("70 done %d \n", percentageDone);
401
+ //scanf("%c", &a);
402
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
403
+ //double wieght = 40*( pow(.5, rnd) );
404
+ clsIndex = (int)( weight* (slop+.1) ); // 40, 20, 10,
405
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
406
+ clsObj = memManager->getClassObject(clsIndex);
407
+ }
408
+ else{
409
+ //printf("90 done %d \n", percentageDone);
410
+ //scanf("%c", &a);
411
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
412
+ //double wieght = 40*( pow(.5, rnd) );
413
+ clsIndex = (int) (weight) ;//( logb(weight)-logb(constantValue) -1 )/(logb(slop)); // 40, 20, 10,
414
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
370
415
clsObj = memManager->getClassObject(clsIndex);
371
- if(cnt == 30){
372
- break;
373
- }
374
416
}
375
417
376
- */
418
+ */
419
+
420
+ /*
421
+ This is very good
422
+
423
+ char a;
424
+
425
+ if(percentageDone<50){
426
+
427
+ double weight = maxWeight*( 1.0*rand()/RAND_MAX);
428
+ //double wieght = 40*( pow(.5, rnd) );
429
+ clsIndex = (int)( logb(weight)-logb(constantValue) -1 )/(logb(slop)); // 40, 20, 10,
430
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
431
+ clsObj = memManager->getClassObject(clsIndex);
432
+
433
+ }
434
+ else if ( (percentageDone>=50) && (percentageDone<70) ){
435
+ //printf("50 done %d \n", percentageDone);
436
+ //scanf("%c", &a);
437
+
438
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
439
+ //double wieght = 40*( pow(.5, rnd) );
440
+ clsIndex = (int)( weight*slop ); // 40, 20, 10,
441
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
442
+ clsObj = memManager->getClassObject(clsIndex);
443
+ }
444
+ else if ( (percentageDone>=70) && (percentageDone<95) ) {
445
+ //printf("70 done %d \n", percentageDone);
446
+ //scanf("%c", &a);
447
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
448
+ //double wieght = 40*( pow(.5, rnd) );
449
+ clsIndex = (int)( weight* (slop-.1) ); // 40, 20, 10,
450
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
451
+ clsObj = memManager->getClassObject(clsIndex);
452
+ }
453
+ else{
454
+ //printf("90 done %d \n", percentageDone);
455
+ //scanf("%c", &a);
456
+ double weight = NUM_CLAZZ*( 1.0*rand()/RAND_MAX);
457
+ //double wieght = 40*( pow(.5, rnd) );
458
+ clsIndex = (int) (weight) ;//( logb(weight)-logb(constantValue) -1 )/(logb(slop)); // 40, 20, 10,
459
+ //printf("W:: %.10lf Index::%d\n", weight, clsIndex);
460
+ clsObj = memManager->getClassObject(clsIndex);
461
+ }
462
+ */
463
+
464
+ // This is for choice of calss in object creation
465
+ // An expenontially decreasing function is used at
466
+ // the begining.
467
+ /* This need to be clean up if necessary */
468
+
469
+ if (percentageDone<40 ){
470
+
471
+ double weight = maxWeight*( 1.0 *rand ()/RAND_MAX);
472
+ // double wieght = 40*( pow(.5, rnd) );
473
+ clsIndex = (int )( logb (weight)-logb (constantValue) -1 )/(logb (slop)); // 40, 20, 10,
474
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
475
+ clsObj = memManager->getClassObject (clsIndex);
476
+
477
+ }
478
+ else if ( (percentageDone>=40 ) && (percentageDone<50 ) ){
479
+ // printf("50 done %d \n", percentageDone);
480
+ double weight = NUM_CLAZZ*( 1.0 *rand ()/RAND_MAX);
481
+ // double wieght = 40*( pow(.5, rnd) );
482
+ clsIndex = (int )( weight*slop ); // 40, 20, 10,
483
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
484
+ clsObj = memManager->getClassObject (clsIndex);
485
+ }
486
+ else if ( (percentageDone>=50 ) && (percentageDone<60 ) ){
487
+ // printf("50 done %d \n", percentageDone);
488
+
489
+ double weight = NUM_CLAZZ*( 1.0 *rand ()/RAND_MAX);
490
+ // double wieght = 40*( pow(.5, rnd) );
491
+ clsIndex = (int )( weight* (slop+.1 ) ); // 40, 20, 10,
492
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
493
+ clsObj = memManager->getClassObject (clsIndex);
494
+ }
495
+
496
+ else if ( (percentageDone>=60 ) && (percentageDone<70 ) ) {
497
+ // printf("70 done %d \n", percentageDone);
498
+ double weight = NUM_CLAZZ*( 1.0 *rand ()/RAND_MAX);
499
+ // double wieght = 40*( pow(.5, rnd) );
500
+ clsIndex = (int )( weight* (slop -.2 ) ); // 40, 20, 10,
501
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
502
+ clsObj = memManager->getClassObject (clsIndex);
503
+ }
504
+
505
+ else if ( (percentageDone>=70 ) && (percentageDone<80 ) ) {
506
+ // printf("70 done %d \n", percentageDone);
507
+
508
+ double weight = NUM_CLAZZ*( 1.0 *rand ()/RAND_MAX);
509
+ // double wieght = 40*( pow(.5, rnd) );
510
+ clsIndex = (int )( weight* (slop-.1 ) ); // 40, 20, 10,
511
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
512
+ clsObj = memManager->getClassObject (clsIndex);
513
+ }
514
+ else if ( (percentageDone>=80 ) && (percentageDone<98 ) ) {
515
+ // printf("70 done %d \n", percentageDone);
516
+
517
+ double weight = NUM_CLAZZ*( 1.0 *rand ()/RAND_MAX);
518
+ // double wieght = 40*( pow(.5, rnd) );
519
+ clsIndex = (int )( weight* (slop-.4 ) ); // 40, 20, 10,
520
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
521
+ clsObj = memManager->getClassObject (clsIndex);
522
+ }
523
+
524
+ else {
525
+ // printf("90 done %d \n", percentageDone);
526
+
527
+ double weight = NUM_CLAZZ*( 1.0 *rand ()/RAND_MAX);
528
+ // double wieght = 40*( pow(.5, rnd) );
529
+ clsIndex = (int ) (weight) * (slop +.3 ) ;// ( logb(weight)-logb(constantValue) -1 )/(logb(slop)); // 40, 20, 10,
530
+ // printf("W:: %.10lf Index::%d\n", weight, clsIndex);
531
+ clsObj = memManager->getClassObject (clsIndex);
532
+ }
533
+
534
+
535
+ /*
536
+ else{
537
+
538
+ //3.0
539
+ // select an entry from class table;
540
+ clsIndex = rand()%NUM_CLAZZ;
541
+ clsObj = memManager->getClassObject(clsIndex);
542
+ // select class which has been acceessed (hit) less
543
+ //int cnt = 0;
544
+ while(clsObj->getAccessCount()>MAXCACCESS){
545
+ cnt++;
546
+ clsIndex = rand()%NUM_CLAZZ;
547
+ clsObj = memManager->getClassObject(clsIndex);
548
+ if(cnt == 30){
549
+ break;
550
+ }
551
+ }
377
552
553
+ }*/
378
554
379
555
380
556
clsObj->increaseAccess ();
0 commit comments