/* * CDE - Common Desktop Environment * * Copyright (c) 1993-2012, The Open Group. All rights reserved. * * These libraries and programs are free software; you can * redistribute them and/or modify them under the terms of the GNU * Lesser General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) * any later version. * * These libraries and programs are distributed in the hope that * they will be useful, but WITHOUT ANY WARRANTY; without even the * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU Lesser General Public License for more * details. * * You should have received a copy of the GNU Lesser General Public * License along with these libraries and programs; if not, write * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth * Floor, Boston, MA 02110-1301 USA */ /* $XConsortium: store_test.C /main/7 1996/08/21 15:56:52 drk $ */ #include #include #include "utility/pm_random.h" #include "storage/page_storage.h" //////////////////////////// // case: store pages exist //////////////////////////// void real_page_cache_test_1(pm_random& rand_gen, page_storage** st, unsigned int ct, unsigned int no_access) { unsigned int j, k; page_storage::access_t l; for ( unsigned int i=0; i< no_access; i++) { j = rand_gen.rand() % ct; // pick the store k = rand_gen.rand() % (st[j] -> pages()) + 1; // pick the page // pick the READ/WRITE option l = (rand_gen.rand_01()>0.5) ? page_storage::READ : page_storage::WRITE; cerr << "store=" << st[j] -> my_name() << " "; cerr << "page=" << k << " "; if (l==page_storage::READ) cerr << "read" ; else cerr << "write"; cerr << "\n"; (*st[j])(k, l); } } page_storage** prepare_store(char* path, lru& open_file_policy, pm_random& rand_gen, unsigned int ct, unsigned int low, unsigned int high) { char name[256]; page_storage** x = new page_storagePtr[ct]; unixf_storage* unix_file = 0; for ( unsigned int i=0; i add_page_frames(pages); } return x; } void quit_store(page_storage** st, unsigned int ct) { for ( unsigned int i=0; i