File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -448,13 +448,15 @@ MemoryPage::MemoryPage() {
448448}
449449
450450MemoryPage::~MemoryPage () {
451+ // reportPageStates();
451452}
452453
453454void MemoryPage::setPageState (PageState s) {
454455 if (s != currentPageState) {
455456 if (currentPageState != PageState::Undefined) {
456457 if (pageStateTimes[(int )currentPageState].t0IsValid ) {
457- pageStateTimes[(int )currentPageState].duration += (std::chrono::duration_cast<std::chrono::seconds>(std::chrono::steady_clock::now () - pageStateTimes[(int )currentPageState].t0 )).count ();
458+ pageStateTimes[(int )currentPageState].duration +=
459+ (std::chrono::duration<double >(std::chrono::steady_clock::now () - pageStateTimes[(int )currentPageState].t0 )).count ();
458460 }
459461 pageStateTimes[(int )currentPageState].t0IsValid = 0 ;
460462 }
@@ -526,3 +528,20 @@ int updatePageStateFromDataBlockContainerReference(DataBlockContainerReference b
526528 if (err) {LOG_CODEWRONG;}
527529 return err;
528530}
531+
532+ void MemoryPage::reportPageStates () {
533+ double t = 0 ;
534+ for (int i=0 ; i<PageState::Undefined; i++) {
535+ t += getPageStateDuration ((PageState)i);
536+ }
537+
538+ printf (" Page %p : " , getPagePtr ());
539+ if (t != 0 ) {
540+ printf (" %12.6fs\t " ,t);
541+ for (int i=0 ; i<PageState::Undefined; i++) {
542+ // printf("%s = %.2f%% ", getPageStateString((PageState)i), getPageStateDuration((PageState)i) * 100 / t);
543+ printf (" %.2f%% \t " , getPageStateDuration ((PageState)i) * 100 / t);
544+ }
545+ }
546+ printf (" \n " );
547+ }
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ class MemoryPage {
5252 void resetPageStates ();
5353 double getPageStateDuration (PageState s);
5454 static const char * getPageStateString (PageState s);
55+ void reportPageStates ();
5556
5657 friend class MemoryPagesPool ;
5758
You can’t perform that action at this time.
0 commit comments