📄 http_distribution.c
字号:
/* * GloMoSim is COPYRIGHTED software. Release 2.02 of GloMoSim is available * at no cost to educational users only. * * Commercial use of this software requires a separate license. No cost, * evaluation licenses are available for such purposes; please contact * info@scalable-networks.com * * By obtaining copies of this and any other files that comprise GloMoSim2.02, * you, the Licensee, agree to abide by the following conditions and * understandings with respect to the copyrighted software: * * 1.Permission to use, copy, and modify this software and its documentation * for education and non-commercial research purposes only is hereby granted * to Licensee, provided that the copyright notice, the original author's * names and unit identification, and this permission notice appear on all * such copies, and that no charge be made for such copies. Any entity * desiring permission to use this software for any commercial or * non-educational research purposes should contact: * * Professor Rajive Bagrodia * University of California, Los Angeles * Department of Computer Science * Box 951596 * 3532 Boelter Hall * Los Angeles, CA 90095-1596 * rajive@cs.ucla.edu * * 2.NO REPRESENTATIONS ARE MADE ABOUT THE SUITABILITY OF THE SOFTWARE FOR ANY * PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. * * 3.Neither the software developers, the Parallel Computing Lab, UCLA, or any * affiliate of the UC system shall be liable for any damages suffered by * Licensee from the use of this software. */// Use the latest version of Parsec if this line causes a compiler error./* * $Id: http_distribution.c,v 1.1 2000/01/10 09:09:34 gandy Exp $ * * This file contains C functions which approximate the functionality of * Bruce Mah's CDF processing class functions. It also contains all of the * CDFs that Bruce Mah has created from network traces. * * This code is adapted from the work published by Bruce Mah. * B. Mah, "An Empirical Model of HTTP Network Traffic", * Proceedings of INFOCOM '97, Kobe, Japan, April 1997. * http://www.ca.sandia.gov/~bmah/Papers/Http-Infocom.ps * * Send questions to Julian Hsu <gandy@cs.ucla.edu> */#include <assert.h>#include <math.h>#include "http_distribution.h"#ifndef TRUE#define TRUE 1#endif#ifndef FALSE#define FALSE 0#endifdouble DoubleDistEmpiricalIntegralInterpolate( double x1, double x2, double y1, double y2, double x) { return ceil((y1 + ((y2 - y1) / (x2 - x1)) * (x - x1)));}double DoubleDistEmpiricalContinuousInterpolate( double x1, double x2, double y1, double y2, double x) { return (y1 + ((y2 - y1) / (x2 - x1)) * (x - x1));}int DoubleDistFindIndex(const DoubleDistElement *array, const long count, double value){ int top = count - 1, bottom = 0, current;#ifdef DEBUG printf(" findindex start value = %f ind0.val = %f\n", value, array[0].cdf);#endif if (value < array[0].cdf) return -1; while (TRUE) {#ifdef DEBUG printf(" current = %d top = %d bottom = %d\n", current, top, bottom); printf(" value = %f cur1 = %f cur2 = %f\n", value, array[current].cdf, array[current+1].cdf);#endif current = (top + bottom) / 2; if ((value >= array[current].cdf) && (value < array[current+1].cdf)) {#ifdef DEBUG printf("DONE\n");#endif return current; break; } else if (value < array[current].cdf) { top = current - 1; } else if (value >= array[current+1].cdf) { bottom = current + 1; } else assert(FALSE); }}// HttpConsecutiveDocs.cc generated from HttpConsecutiveDocs.cdf// on Wed Oct 27 00:28:20 PDT 1999 by gandystatic DoubleDistElement foo[] = {{ 1 , 0.355731225296 }, { 2 , 0.549407114625 }, { 3 , 0.664031620553 }, { 4 , 0.747035573123 }, { 5 , 0.790513833992 }, { 6 , 0.814229249012 }, { 7 , 0.841897233202 }, { 8 , 0.881422924901 }, { 9 , 0.893280632411 }, { 10 , 0.901185770751 }, { 11 , 0.905138339921 }, { 12 , 0.909090909091 }, { 13 , 0.928853754941 }, { 14 , 0.944664031621 }, { 15 , 0.95652173913 }, { 16 , 0.96442687747 }, { 17 , 0.96837944664 }, { 18 , 0.97628458498 }, { 19 , 0.99209486166 }, { 21 , 0.99604743083 }, { 37 , 1 }};int HttpConsecutiveDocsDistLength = 21 ;// Indirection is needed to fool damaged linkerDoubleDistElement *HttpConsecutiveDocsDistTable = foo;// HttpFilesPerDocument.cc generated from HttpFilesPerDocument.cdf// on Wed Oct 27 00:28:21 PDT 1999 by gandystatic DoubleDistElement foo1[] = {{ 1 , 0.486376811594 }, { 2 , 0.691594202899 }, { 3 , 0.781449275362 }, { 4 , 0.826086956522 }, { 5 , 0.875362318841 }, { 6 , 0.904347826087 }, { 7 , 0.92347826087 }, { 8 , 0.939710144928 }, { 9 , 0.950724637681 }, { 10 , 0.96115942029 }, { 11 , 0.966376811594 }, { 12 , 0.972173913043 }, { 13 , 0.974492753623 }, { 14 , 0.977971014493 }, { 15 , 0.980289855072 }, { 16 , 0.987246376812 }, { 17 , 0.987826086957 }, { 18 , 0.989565217391 }, { 19 , 0.993043478261 }, { 20 , 0.995942028986 }, { 21 , 0.99652173913 }, { 32 , 0.997101449275 }, { 33 , 0.99768115942 }, { 35 , 0.998260869565 }, { 37 , 0.99884057971 }, { 63 , 0.999420289855 }, { 65 , 1 }};int HttpFilesPerDocumentDistLength = 27 ;// Indirection is needed to fool damaged linkerDoubleDistElement *HttpFilesPerDocumentDistTable = foo1;// HttpPrimaryReply.cc generated from HttpPrimaryReply.cdf// on Wed Oct 27 00:28:23 PDT 1999 by gandystatic DoubleDistElement foo2[] = {{ 0 , 0.00231749710313 }, { 81 , 0.0150637311703 }, { 83 , 0.0173812282735 }, { 87 , 0.0179606025492 }, { 90 , 0.018539976825 }, { 102 , 0.0220162224797 }, { 103 , 0.0295480880649 }, { 104 , 0.0428736964079 }, { 110 , 0.0440324449594 }, { 195 , 0.045191193511 }, { 196 , 0.0457705677868 }, { 203 , 0.0509849362688 }, { 204 , 0.0527230590962 }, { 207 , 0.053302433372 }, { 210 , 0.0538818076477 }, { 211 , 0.0544611819235 }, { 219 , 0.0573580533024 }, { 225 , 0.0579374275782 }, { 231 , 0.058516801854 }, { 233 , 0.0590961761298 }, { 234 , 0.0602549246813 }, { 237 , 0.0608342989571 }, { 240 , 0.0619930475087 }, { 242 , 0.063731170336 }, { 244 , 0.0643105446118 }, { 246 , 0.0654692931634 }, { 247 , 0.0660486674392 }, { 249 , 0.0666280417149 }, { 250 , 0.0677867902665 }, { 252 , 0.0683661645423 }, { 253 , 0.0689455388181 }, { 254 , 0.0706836616454 }, { 258 , 0.071842410197 }, { 259 , 0.0730011587486 }, { 264 , 0.0735805330243 }, { 269 , 0.0741599073001 }, { 277 , 0.0753186558517 }, { 279 , 0.0758980301275 }, { 280 , 0.077056778679 }, { 281 , 0.0776361529548 }, { 284 , 0.0787949015064 }, { 285 , 0.0793742757822 }, { 286 , 0.0811123986095 }, { 287 , 0.0828505214368 }, { 288 , 0.0834298957126 }, { 291 , 0.0840092699884 }, { 293 , 0.0845886442642 }, { 295 , 0.0857473928158 }, { 296 , 0.0874855156431 }, { 297 , 0.0886442641947 }, { 298 , 0.0892236384705 }, { 300 , 0.090382387022 }, { 301 , 0.0909617612978 }, { 304 , 0.0921205098494 }, { 306 , 0.0967555040556 }, { 307 , 0.0996523754345 }, { 308 , 0.101969872538 }, { 310 , 0.115295480881 }, { 312 , 0.118771726535 }, { 314 , 0.124565469293 }, { 316 , 0.130359212051 }, { 318 , 0.131517960603 }, { 320 , 0.132676709154 }, { 322 , 0.134994206257 }, { 324 , 0.136152954809 }, { 326 , 0.13731170336 }, { 327 , 0.137891077636 }, { 328 , 0.138470451912 }, { 329 , 0.139049826188 }, { 330 , 0.139629200463 }, { 331 , 0.140208574739 }, { 332 , 0.141367323291 }, { 333 , 0.143105446118 }, { 334 , 0.14426419467 }, { 335 , 0.145422943221 }, { 336 , 0.151216685979 }, { 337 , 0.151796060255 }, { 338 , 0.152375434531 }, { 340 , 0.152954808806 }, { 342 , 0.154113557358 }, { 343 , 0.15527230591 }, { 344 , 0.157589803013 }, { 345 , 0.158169177289 }, { 350 , 0.158748551564 }, { 351 , 0.15932792584 }, { 356 , 0.159907300116 }, { 362 , 0.162224797219 }, { 364 , 0.163962920046 }, { 366 , 0.164542294322 }, { 368 , 0.169177288528 }, { 370 , 0.171494785632 }, { 372 , 0.174971031286 }, { 376 , 0.178447276941 }, { 383 , 0.179026651217 }, { 384 , 0.179606025492 }, { 385 , 0.180185399768 }, { 389 , 0.181923522596 }, { 400 , 0.182502896871 }, { 404 , 0.183082271147 }, { 405 , 0.184241019699 }, { 407 , 0.184820393975 }, { 409 , 0.185979142526 }, { 411 , 0.186558516802 }, { 416 , 0.187137891078 }, { 417 , 0.187717265353 }, { 418 , 0.188296639629 }, { 423 , 0.190614136732 }, { 428 , 0.191193511008 }, { 429 , 0.191772885284 }, { 435 , 0.19235225956 }, { 437 , 0.192931633835 }, { 438 , 0.193511008111 }, { 454 , 0.194090382387 }, { 455 , 0.196987253766 }, { 456 , 0.199304750869 }, { 459 , 0.199884125145 }, { 460 , 0.200463499421 }, { 463 , 0.204519119351 }, { 471 , 0.205677867903 }, { 472 , 0.206257242178 }, { 481 , 0.207995365006 }, { 483 , 0.209154113557 }, { 487 , 0.209733487833 }, { 499 , 0.210312862109 }, { 502 , 0.210892236385 }, { 507 , 0.21147161066 }, { 508 , 0.213209733488 }, { 520 , 0.213789107764 }, { 525 , 0.214368482039 }, { 529 , 0.215527230591 }, { 530 , 0.216106604867 }, { 531 , 0.216685979143 }, { 535 , 0.217265353418 }, { 536 , 0.221900347625 }, { 551 , 0.2224797219 }, { 553 , 0.223059096176 }, { 555 , 0.223638470452 }, { 560 , 0.224217844728 }, { 563 , 0.225376593279 }, { 574 , 0.225955967555 }, { 580 , 0.227694090382 }, { 581 , 0.228852838934 }, { 583 , 0.22943221321 }, { 584 , 0.230590961761 }, { 590 , 0.231170336037 }, { 592 , 0.231749710313 }, { 593 , 0.232908458864 }, { 604 , 0.23348783314 }, { 610 , 0.234067207416 }, { 615 , 0.234646581692 }, { 623 , 0.235225955968 }, { 628 , 0.235805330243 }, { 633 , 0.236384704519 }, { 635 , 0.236964078795 }, { 642 , 0.238122827346 }, { 643 , 0.238702201622 }, { 648 , 0.239281575898 }, { 655 , 0.239860950174 }, { 666 , 0.241019698725 }, { 678 , 0.241599073001 }, { 690 , 0.242178447277 }, { 692 , 0.242757821553 }, { 693 , 0.243916570104 }, { 695 , 0.24449594438 }, { 696 , 0.245654692932 }, { 703 , 0.246234067207 }, { 710 , 0.246813441483 }, { 712 , 0.247392815759 }, { 715 , 0.247972190035 }, { 716 , 0.249130938586 }, { 717 , 0.249710312862 }, { 723 , 0.250289687138 }, { 726 , 0.250869061414 }, { 731 , 0.251448435689 }, { 732 , 0.253186558517 }, { 734 , 0.253765932793 }, { 737 , 0.254345307068 }, { 748 , 0.25550405562 }, { 760 , 0.256083429896 }, { 761 , 0.256662804171 }, { 763 , 0.257242178447 }, { 769 , 0.258400926999 }, { 770 , 0.258980301275 }, { 771 , 0.25955967555 }, { 772 , 0.260139049826 }, { 773 , 0.261877172654 }, { 774 , 0.262456546929 }, { 775 , 0.263615295481 }, { 776 , 0.265353418308 }, { 777 , 0.265932792584 }, { 779 , 0.267091541136 }, { 781 , 0.267670915411 }, { 782 , 0.268250289687 }, { 786 , 0.269409038239 }, { 795 , 0.269988412514 }, { 803 , 0.27056778679 }, { 806 , 0.271726535342 }, { 807 , 0.272305909618 }, { 820 , 0.272885283893 }, { 822 , 0.273464658169 }, { 826 , 0.274044032445 }, { 828 , 0.274623406721 }, { 845 , 0.275202780997 }, { 851 , 0.275782155272 }, { 856 , 0.276361529548 }, { 857 , 0.2775202781 }, { 875 , 0.278099652375 }, { 888 , 0.278679026651 }, { 890 , 0.279258400927 }, { 893 , 0.279837775203 }, { 896 , 0.280996523754 }, { 898 , 0.28157589803 }, { 902 , 0.283314020857 }, { 907 , 0.283893395133 }, { 908 , 0.284472769409 }, { 912 , 0.285052143685 }, { 914 , 0.286210892236 }, { 919 , 0.286790266512 }, { 923 , 0.287949015064 }, { 930 , 0.28852838934 }, { 934 , 0.289107763615 }, { 935 , 0.290845886443 }, { 936 , 0.294901506373 }, { 937 , 0.295480880649 }, { 938 , 0.300115874855 }, { 939 , 0.300695249131 }, { 941 , 0.301274623407 }, { 949 , 0.304750869061 }, { 950 , 0.305909617613 }, { 955 , 0.306488991889 }, { 957 , 0.307068366165 }, { 969 , 0.30764774044 }, { 979 , 0.308227114716 }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -