亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? store_repl_heap.c

?? 代理服務器 squid-2.6.STABLE16
?? C
字號:
/* * $Id: store_repl_heap.c,v 1.11 2005/05/17 16:56:44 hno Exp $ * * DEBUG: section ?     HEAP based removal policies * AUTHOR: Henrik Nordstrom * * Based on the ideas of the heap policy implemented by John Dilley of * Hewlett Packard. Rewritten from scratch when modularizing the removal * policy implementation of Squid. * * For details on the original heap policy work and the thinking behind see * http://www.hpl.hp.com/techreports/1999/HPL-1999-69.html * *  * SQUID Web Proxy Cache          http://www.squid-cache.org/ * ---------------------------------------------------------- * *  Squid is the result of efforts by numerous individuals from *  the Internet community; see the CONTRIBUTORS file for full *  details.   Many organizations have provided support for Squid's *  development; see the SPONSORS file for full details.  Squid is *  Copyrighted (C) 2001 by the Regents of the University of *  California; see the COPYRIGHT file for full details.  Squid *  incorporates software developed and/or copyrighted by other *  sources; see the CREDITS file for full details. * *  This program is free software; you can redistribute it and/or modify *  it under the terms of the GNU General Public License as published by *  the Free Software Foundation; either version 2 of the License, or *  (at your option) any later version. *   *  This program is distributed in the hope that it will be useful, *  but WITHOUT ANY WARRANTY; without even the implied warranty of *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the *  GNU General Public License for more details. *   *  You should have received a copy of the GNU General Public License *  along with this program; if not, write to the Free Software *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111, USA. * */#include "squid.h"#include "heap.h"#include "store_heap_replacement.h"REMOVALPOLICYCREATE createRemovalPolicy_heap;static int nr_heap_policies = 0;typedef struct _HeapPolicyData HeapPolicyData;struct _HeapPolicyData {    RemovalPolicy *policy;    heap *heap;    heap_key_func *keyfunc;    int count;    int nwalkers;    enum heap_entry_type {	TYPE_UNKNOWN = 0, TYPE_STORE_ENTRY, TYPE_STORE_MEM    } type;};/* Hack to avoid having to remember the RemovalPolicyNode location. * Needed by the purge walker. */static enum heap_entry_typeheap_guessType(StoreEntry * entry, RemovalPolicyNode * node){    if (node == &entry->repl)	return TYPE_STORE_ENTRY;    if (entry->mem_obj && node == &entry->mem_obj->repl)	return TYPE_STORE_MEM;    fatal("Heap Replacement: Unknown StoreEntry node type");    return TYPE_UNKNOWN;}#define SET_POLICY_NODE(entry,value) \    switch(heap->type) { \    case TYPE_STORE_ENTRY: entry->repl.data = value; break ; \    case TYPE_STORE_MEM: entry->mem_obj->repl.data = value ; break ; \    default: break; \    }static voidheap_add(RemovalPolicy * policy, StoreEntry * entry, RemovalPolicyNode * node){    HeapPolicyData *heap = policy->_data;    assert(!node->data);    if (EBIT_TEST(entry->flags, ENTRY_SPECIAL))	return;			/* We won't manage these.. they messes things up */    node->data = heap_insert(heap->heap, entry);    heap->count += 1;    if (!heap->type)	heap->type = heap_guessType(entry, node);    /* Add a little more variance to the aging factor */    heap->heap->age += heap->heap->age / 100000000;}static voidheap_remove(RemovalPolicy * policy, StoreEntry * entry,    RemovalPolicyNode * node){    HeapPolicyData *heap = policy->_data;    heap_node *hnode = node->data;    if (!hnode)	return;    heap_delete(heap->heap, hnode);    node->data = NULL;    heap->count -= 1;}static voidheap_referenced(RemovalPolicy * policy, const StoreEntry * entry,    RemovalPolicyNode * node){    HeapPolicyData *heap = policy->_data;    heap_node *hnode = node->data;    if (!hnode)	return;    heap_update(heap->heap, hnode, (StoreEntry *) entry);}/** RemovalPolicyWalker **/typedef struct _HeapWalkData HeapWalkData;struct _HeapWalkData {    int current;};static const StoreEntry *heap_walkNext(RemovalPolicyWalker * walker){    HeapWalkData *heap_walk = walker->_data;    RemovalPolicy *policy = walker->_policy;    HeapPolicyData *heap = policy->_data;    StoreEntry *entry;    if (heap_walk->current >= heap_nodes(heap->heap))	return NULL;		/* done */    entry = (StoreEntry *) heap_peep(heap->heap, heap_walk->current++);    return entry;}static voidheap_walkDone(RemovalPolicyWalker * walker){    RemovalPolicy *policy = walker->_policy;    HeapPolicyData *heap = policy->_data;    assert(strcmp(policy->_type, "heap") == 0);    assert(heap->nwalkers > 0);    heap->nwalkers -= 1;    safe_free(walker->_data);    cbdataFree(walker);}static RemovalPolicyWalker *heap_walkInit(RemovalPolicy * policy){    HeapPolicyData *heap = policy->_data;    RemovalPolicyWalker *walker;    HeapWalkData *heap_walk;    heap->nwalkers += 1;    walker = cbdataAlloc(RemovalPolicyWalker);    heap_walk = xcalloc(1, sizeof(*heap_walk));    heap_walk->current = 0;    walker->_policy = policy;    walker->_data = heap_walk;    walker->Next = heap_walkNext;    walker->Done = heap_walkDone;    return walker;}/** RemovalPurgeWalker **/typedef struct _HeapPurgeData HeapPurgeData;struct _HeapPurgeData {    link_list *locked_entries;    heap_key min_age;};static StoreEntry *heap_purgeNext(RemovalPurgeWalker * walker){    HeapPurgeData *heap_walker = walker->_data;    RemovalPolicy *policy = walker->_policy;    HeapPolicyData *heap = policy->_data;    StoreEntry *entry;    heap_key age;  try_again:    if (!heap_nodes(heap->heap) > 0)	return NULL;		/* done */    age = heap_peepminkey(heap->heap);    entry = heap_extractmin(heap->heap);    if (storeEntryLocked(entry)) {	storeLockObject(entry);	linklistPush(&heap_walker->locked_entries, entry);	goto try_again;    }    heap_walker->min_age = age;    SET_POLICY_NODE(entry, NULL);    return entry;}static voidheap_purgeDone(RemovalPurgeWalker * walker){    HeapPurgeData *heap_walker = walker->_data;    RemovalPolicy *policy = walker->_policy;    HeapPolicyData *heap = policy->_data;    StoreEntry *entry;    assert(strcmp(policy->_type, "heap") == 0);    assert(heap->nwalkers > 0);    heap->nwalkers -= 1;    if (heap_walker->min_age > 0) {	heap->heap->age = heap_walker->min_age;	debug(81, 3) ("heap_purgeDone: Heap age set to %f\n",	    (double) heap->heap->age);    }    /*     * Reinsert the locked entries     */    while ((entry = linklistShift(&heap_walker->locked_entries))) {	heap_node *node = heap_insert(heap->heap, entry);	SET_POLICY_NODE(entry, node);	storeUnlockObject(entry);    }    safe_free(walker->_data);    cbdataFree(walker);}static RemovalPurgeWalker *heap_purgeInit(RemovalPolicy * policy, int max_scan){    HeapPolicyData *heap = policy->_data;    RemovalPurgeWalker *walker;    HeapPurgeData *heap_walk;    heap->nwalkers += 1;    walker = cbdataAlloc(RemovalPurgeWalker);    heap_walk = xcalloc(1, sizeof(*heap_walk));    heap_walk->min_age = 0.0;    heap_walk->locked_entries = NULL;    walker->_policy = policy;    walker->_data = heap_walk;    walker->max_scan = max_scan;    walker->Next = heap_purgeNext;    walker->Done = heap_purgeDone;    return walker;}static voidheap_free(RemovalPolicy * policy){    HeapPolicyData *heap = policy->_data;    /* Make some verification of the policy state */    assert(strcmp(policy->_type, "heap") == 0);    assert(heap->nwalkers);    assert(heap->count);    /* Ok, time to destroy this policy */    safe_free(policy->_data);    memset(policy, 0, sizeof(*policy));    cbdataFree(policy);}RemovalPolicy *createRemovalPolicy_heap(wordlist * args){    RemovalPolicy *policy;    HeapPolicyData *heap_data;    const char *keytype;    /* Allocate the needed structures */    policy = cbdataAlloc(RemovalPolicy);    heap_data = xcalloc(1, sizeof(*heap_data));    /* Initialize the policy data */    heap_data->policy = policy;    if (args) {	keytype = args->key;	args = args->next;    } else {	debug(81, 1) ("createRemovalPolicy_heap: No key type specified. Using LRU\n");	keytype = "LRU";    }    if (!strcmp(keytype, "GDSF"))	heap_data->keyfunc = HeapKeyGen_StoreEntry_GDSF;    else if (!strcmp(keytype, "LFUDA"))	heap_data->keyfunc = HeapKeyGen_StoreEntry_LFUDA;    else if (!strcmp(keytype, "LRU"))	heap_data->keyfunc = HeapKeyGen_StoreEntry_LRU;    else {	debug(81, 0) ("createRemovalPolicy_heap: Unknown key type \"%s\". Using LRU\n",	    keytype);	heap_data->keyfunc = HeapKeyGen_StoreEntry_LRU;    }    /* No additional arguments expected */    assert(!args);    heap_data->heap = new_heap(1000, heap_data->keyfunc);    heap_data->heap->age = 1.0;    /* Populate the policy structure */    policy->_type = "heap";    policy->_data = heap_data;    policy->Free = heap_free;    policy->Add = heap_add;    policy->Remove = heap_remove;    policy->Referenced = NULL;    policy->Dereferenced = heap_referenced;    policy->WalkInit = heap_walkInit;    policy->PurgeInit = heap_purgeInit;    /* Increase policy usage count */    nr_heap_policies += 0;    return policy;}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91免费国产在线| 欧美日韩一区二区三区在线| 一本色道亚洲精品aⅴ| 日韩女优毛片在线| 亚洲国产精品综合小说图片区| 国产在线乱码一区二区三区| 91福利在线导航| 国产精品色哟哟网站| 久久99最新地址| 91精品国产入口在线| 亚洲二区在线视频| 91猫先生在线| 日韩毛片一二三区| 成人av网站大全| 久久久国产午夜精品| 久久69国产一区二区蜜臀| 777久久久精品| 亚洲成av人影院在线观看网| 91成人免费在线| 亚洲欧美日韩国产综合| 东方aⅴ免费观看久久av| 精品福利一二区| 精品在线播放午夜| 欧美精品一区视频| 黄色精品一二区| 久久尤物电影视频在线观看| 另类综合日韩欧美亚洲| 欧美一区二区三区在线观看| 日韩在线卡一卡二| 欧美美女直播网站| 日韩在线观看一区二区| 日韩欧美一二区| 国产综合久久久久久鬼色| 精品国产乱码久久久久久1区2区| 人妖欧美一区二区| 欧美一区二区三区公司| 男人操女人的视频在线观看欧美| 91.com在线观看| 极品美女销魂一区二区三区免费| 久久午夜国产精品| 成人一级片网址| 亚洲视频在线一区| 欧美日韩亚洲综合在线| 日韩av中文字幕一区二区三区| 日韩视频永久免费| 国产成人在线看| 一区二区三区在线观看视频| 欧美性感一区二区三区| 免费在线看一区| 亚洲国产精品激情在线观看| 91免费在线视频观看| 午夜精品久久久| 久久综合999| 色婷婷综合久久久中文字幕| 午夜精品aaa| 久久精品视频一区二区三区| 色综合久久久久网| 蜜桃免费网站一区二区三区| 国产欧美一区二区三区在线看蜜臀 | 亚洲精品日日夜夜| 777欧美精品| 成人免费看视频| 亚洲一区二区三区不卡国产欧美| 欧美一级xxx| 91丝袜呻吟高潮美腿白嫩在线观看| 亚洲国产色一区| 国产午夜亚洲精品午夜鲁丝片| 91理论电影在线观看| 日韩av在线播放中文字幕| 国产日韩欧美亚洲| 欧美日韩精品一区二区| 国产一区二区三区最好精华液| 成人欧美一区二区三区| 精品欧美一区二区在线观看| 91亚洲男人天堂| 蜜臀精品久久久久久蜜臀 | wwww国产精品欧美| 欧美日韩在线播放三区四区| 国产成人免费在线观看| 婷婷综合五月天| 亚洲欧洲成人精品av97| 亚洲精品一区二区精华| 欧美日韩国产美女| 99久久99久久精品免费看蜜桃| 玖玖九九国产精品| 亚洲国产综合视频在线观看| 国产精品久99| 久久久精品tv| 精品国偷自产国产一区| 欧美精品丝袜中出| 在线观看视频一区二区欧美日韩| 国产999精品久久久久久绿帽| 蜜桃av一区二区三区| 亚洲成人高清在线| 亚洲精品高清视频在线观看| 国产精品视频九色porn| 国产性色一区二区| www久久精品| 亚洲精品一区二区三区蜜桃下载 | 欧洲在线/亚洲| 99精品热视频| 成人免费毛片app| 成人网在线播放| 国产suv一区二区三区88区| 蜜臀av一区二区在线观看| 图片区小说区区亚洲影院| 亚洲综合激情小说| 亚洲综合丁香婷婷六月香| 一区二区三国产精华液| 亚洲影视资源网| 一区二区不卡在线播放| 一区二区三区在线视频免费观看| 亚洲欧美色一区| 亚洲一区二区三区中文字幕| 一区二区日韩av| 天天做天天摸天天爽国产一区 | 欧美精品久久一区二区三区| 欧美日韩在线观看一区二区 | 欧美色网站导航| 欧美日韩中文字幕一区| 欧美精品在欧美一区二区少妇| 欧美日韩国产123区| 欧美一级二级三级蜜桃| 精品粉嫩aⅴ一区二区三区四区| 精品国产髙清在线看国产毛片| 精品国产一区二区三区久久影院| 久久新电视剧免费观看| 国产精品福利在线播放| 亚洲日本va在线观看| 亚洲va欧美va国产va天堂影院| 日韩va亚洲va欧美va久久| 狠狠色狠狠色合久久伊人| 成人av网站免费| 欧美在线三级电影| 精品国产91洋老外米糕| 中文字幕永久在线不卡| 污片在线观看一区二区| 国产精品亚洲一区二区三区妖精 | 白白色 亚洲乱淫| 色av成人天堂桃色av| 日韩一级在线观看| 国产精品私房写真福利视频| 亚洲一区二区三区四区五区中文| 蜜臀av一区二区在线观看| 国产成+人+日韩+欧美+亚洲| 在线日韩一区二区| 337p粉嫩大胆噜噜噜噜噜91av | 最新不卡av在线| 天天影视涩香欲综合网| 国产成人在线网站| 欧美日韩dvd在线观看| 日本一区二区三区四区在线视频| 亚洲国产精品久久久久婷婷884 | 国产精品一二三在| 欧美私人免费视频| 国产日韩成人精品| 青青草成人在线观看| aa级大片欧美| 日韩免费看的电影| 亚洲制服丝袜在线| 成人午夜私人影院| 日韩欧美在线不卡| 亚洲国产精品久久一线不卡| 懂色av一区二区三区蜜臀| 欧美一级爆毛片| 亚洲午夜精品网| 99综合影院在线| www国产成人免费观看视频 深夜成人网| 亚洲欧美欧美一区二区三区| 国产伦精一区二区三区| 91精品国模一区二区三区| 亚洲人成网站在线| 成人精品一区二区三区四区| 日韩视频免费观看高清完整版 | 欧美肥大bbwbbw高潮| 国产精品久久久久久久久免费桃花| 蜜芽一区二区三区| 欧美亚洲国产一卡| 亚洲天天做日日做天天谢日日欢 | 678五月天丁香亚洲综合网| 亚洲欧洲美洲综合色网| 国产精品18久久久久久久久| 欧美一卡二卡在线| 日韩av在线播放中文字幕| 欧美日本视频在线| 亚洲超碰97人人做人人爱| 在线看日韩精品电影| 亚洲综合清纯丝袜自拍| 欧美在线色视频| 亚洲国产精品久久艾草纯爱| 欧洲精品视频在线观看| 亚洲午夜视频在线| 99热国产精品| 亚洲人精品午夜| 日本道在线观看一区二区| 亚洲综合无码一区二区| 欧美日韩免费观看一区二区三区| 亚洲一区在线播放| 337p亚洲精品色噜噜狠狠| 日韩在线卡一卡二|