当前位置: 首页>>代码示例>>C++>>正文


C++ Stats类代码示例

本文整理汇总了C++中Stats的典型用法代码示例。如果您正苦于以下问题:C++ Stats类的具体用法?C++ Stats怎么用?C++ Stats使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Stats类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: drawSpeed

int drawSpeed(Graphics *gra, int posX, int posY){

	// 速度表示部の背景を白くする
	SolidBrush b(Color(180,255,255,255));
	backGra->FillRectangle(&b, posX, posY, 200, 14);
	// フォント設定
	Font font(L"MS Pゴシック",10);
	// 文字色
	SolidBrush strBrush(Color::Black);
	// 文字列作成
	char tmp[256];
	sprintf(tmp, "R:%.1fkbps S:%.1fkbps", 
		BYTES_TO_KBPS(stats.getPerSecond(Stats::BYTESIN)-stats.getPerSecond(Stats::LOCALBYTESIN)),
		BYTES_TO_KBPS(stats.getPerSecond(Stats::BYTESOUT)-stats.getPerSecond(Stats::LOCALBYTESOUT)));
	_bstr_t bstr(tmp);
	// 文字表示範囲指定
	StringFormat format;
	format.SetAlignment(StringAlignmentCenter);
	RectF r((REAL)posX, (REAL)posY, (REAL)200, (REAL)14);
	// 文字描画
	gra->DrawString(bstr, -1, &font, r, &format, &strBrush);



	return posY + 15;
}
开发者ID:PyYoshi,项目名称:PeerCastIM-Mod,代码行数:26,代码来源:gui.cpp

示例2: main

int main(int argc, char * argv[])
{
    Stats s;
    string str;
    int temp1;	  //a temp variable to get the year data
    float temp2;		//a temp variable to get the month data
    float temp3;		//a temp variable to get the CO2 level data

    cout << argv[0] << " - " << argv[1] << endl;

    ifstream inFile;
    inFile.open(argv[1]);

    do
    {
        inFile >> str;
    } while (str != "MLO");	//To throw away the text we don't need

    do
    {
        inFile >> temp1;
        inFile >> temp2;
        inFile >> temp3;
        str = " ";
        inFile >> str;
        s.addVar(temp3);
    } while (str == "MLO");    //To read the text we need till there is nothing.

    s.showData();	//show the data
    s.clearData();	//clear the data

    inFile.close();
    return 0;
}
开发者ID:wsadwsad,项目名称:MyProjects,代码行数:34,代码来源:climate.cpp

示例3: perform

void TTest::perform(const int index, Stats& stats)
{

  // This can happen when we do one last t-test at the end of
  // a simulation and we've already done one recently enough
  // that we don't have any samples for this one.
  // If there is only one sample should we skip that also?
  if (_stat2.getNrSamples() == 0)
    {
      return;
    }

  if (_stat1.getNrSamples() == 0)
    {
      _stat1 = _stat2;
    }

  // If no bacteria it always clearance, regardless of the type of t-test used.
  if (stats.getTotExtMtb() + stats.getTotIntMtb() == 0)
    {
      stats.setStatus(index, GR_CLEARANCE);
      return;
    }

  double v = degreesOfFreedom();

  evaluate(index, stats, v);

  _stat1 = _stat2;
  _stat2.reset();
}
开发者ID:gmackie,项目名称:GR-ABM-ODE-2D,代码行数:31,代码来源:ttest.cpp

示例4: filter_paired_reads

/*! \brief Filter paired-end reads by patterns
 *
 *  \param[in]  reads1_f    an input stream of paired-end read 1 sequences
 *  \param[in]  reads2_f    an input stream of paired-end read 2 sequences
 *  \param[out] ok1_f       an output stream to write filtered paired-end read 1 sequences to
 *  \param[out] ok2_f       an output stream to write filtered paired-end read 2 sequences to
 *  \param[out] stats1      statistics on first parts of processed reads
 *  \param[out] stats2      statistics on second parts of processed reads
 *  \param[in]  root        a root of the trie structure used to perform string matching
 *  \param[in]  patterns    a vector of patterns for read filtration
 *  \param[in]  length      the read length threshold
 *  \param[in]  dust_k      the DUST algorithm parameter
 *  \param[in]  dust_cutoff the DUST score threshold
 *  \param[in]  errors      the number of resolved mismatches between a read and
 *                          a pattern
 */
void filter_paired_reads(std::ifstream & reads1_f, std::ifstream & reads2_f,
                         std::ofstream & ok1_f, std::ofstream & ok2_f,
                         Stats & stats1, Stats & stats2,
                         Node * root, std::vector <std::pair<std::string, Node::Type> > const & patterns, int errors)
{
    Seq read1;
    Seq read2;
    int processed = 0;

    while (read1.read_seq(reads1_f) && read2.read_seq(reads2_f)) {
        ReadType type1 = check_read(read1.seq, root, patterns, 0, 0, 0, errors);
        ReadType type2 = check_read(read2.seq, root, patterns, 0, 0, 0, errors);
        if (type1 == ReadType::ok && type2 == ReadType::ok) {
            read1.write_seq(ok1_f);
            read2.write_seq(ok2_f);
            stats1.update(type1, true);
            stats2.update(type2, true);
        } else {
            stats1.update(type1, false);
            stats2.update(type2, false);
        }

        processed += 1;
        if (processed % 1000000 == 0) {
            std::cerr << "Processed: " << processed << std::endl;
        }
    }
}
开发者ID:hjanime,项目名称:Cookiecutter,代码行数:44,代码来源:remove.cpp

示例5: createReport

void createReport(Stats runners)
{
	cout << endl << "Tulsa Tigers Track Team" << endl << endl;
	cout << "Average 100 yard-dash time: " << runners.average() << " seconds" << endl;
	cout << "Slowest runner: " << runners.lowest() << " seconds" << endl;
	cout << "Fastest runner: " << runners.highest() << " seconds" << endl;
}
开发者ID:gutty333,项目名称:Practice-2,代码行数:7,代码来源:Week+7+Program+12.cpp

示例6: main

int main() {
	S = Stats();
	string queryFile,data,output;
	cin >> queryFile >> data >> output;  
	Q.setQuery(queryFile);
	inputData(data);
	clock_t s = clock();
	//This constructs our index on the basis of min dimension
	T.initialize(Data,1);
	//This constructs our index on the basis of n-k+1_th or k_th min dimension based on whether K<=D/2 or K>D/2
	R.initialize((Q.K<=Q.D/2?Q.D-Q.K+1:Q.K));
	//This is the list of pruned out points sorted on the basis of time-stamp(in our case the min attribute value)
	P.initialize(0);
	
	indexedTwoPass();
	clock_t e = clock();
	S.setRunningTime(e-s);
	
	cout << "IndexedTwoPass\t" << data << "\t" << Q.K << "\t" ;  
	S.printStats();
	
	sort(S.skyIds.begin(),S.skyIds.end());
	ofstream out(output);
	assert(out.is_open());
	out.precision(dbl::digits10);
	for(int i=0;i < S.skyIds.size();i++) {
		out << S.skyIds[i]+1 << " ";
		for(int j=0;j<(int)Data[S.skyIds[i]].attr.size();j++)
			out << scientific <<Data[S.skyIds[i]].attr[j] << " ";
		out << endl;
	}
	return 0;
}
开发者ID:shubhag,项目名称:Skyproject,代码行数:33,代码来源:indexedTwoPass.cpp

示例7: exchangeStats

    /**
     * Exchange the statistics between instances.
     * @param[in|out] myStats starts with the local information and is populated with the aggregation of the global
     *                        information on instance 0. Not changed on other instances.
     * @param query the query context
     */
    void exchangeStats(Stats& myStats, shared_ptr<Query>& query)
    {
        if (query->getInstanceID() != 0)
        {
            /* I am not instance 0, so send my stuff to instance 0 */
            shared_ptr<SharedBuffer> buf = myStats.marshall();
            /* Non-blocking send. Must be matched by a BufReceive call on the recipient */
            BufSend(0, buf, query);
        }
        else
        {
            /*I am instance 0, receive stuff rom all other instances */
            for (InstanceID i = 1; i<query->getInstancesCount(); ++i)
            {
                /* Blocking receive. */
                shared_ptr<SharedBuffer> buf = BufReceive(i, query);
                Stats otherInstanceStats(buf);
                /* add data to myStats */
                myStats.merge(otherInstanceStats);
            }
        }

        /* Note: at the moment instance 0 IS synonymous with "coordinator". In the future we may move to a more
         * advanced multiple-coordinator scheme.
         */
    }
开发者ID:Goon83,项目名称:scidb,代码行数:32,代码来源:PhysicalInstanceStats.cpp

示例8: DoStatsReset

	void DoStatsReset(CommandSource &source)
	{
		Stats *stats = Serialize::GetObject<Stats *>();
		stats->SetMaxUserCount(UserListByNick.size());
		source.Reply(_("Statistics reset."));
		return;
	}
开发者ID:,项目名称:,代码行数:7,代码来源:

示例9: main

// where all the action happens. 
int main(int argc, char *argv[]) {

  if (argc != 3) {
    cerr << "USAGE: 'progName' numHiddenNodes numEpochs" << endl;
    exit(1);
  }

  int numHidden = atoi(argv[1]);
  int numEpochs = atoi(argv[2]);
 
  bool debug = true;
  
  Stats *s = new Stats(numEpochs, debug);


  // train and save weights along the way
  s->getWeights(numHidden, 0.05);
  
  // gather stats on the networks every 10 epochs by loading the saved weights and running the net on the test set. Saves stat results to a .csv file
  for (int i = 0; i <= numEpochs; i+=10) {
    if (debug)
      cout << 100*(double)i/(double)(numEpochs) << "\tpercent tested\n";
    stringstream fileName;
    fileName << numHidden << "-" << i << ".weights";
      
    // run test set on the net saved in the numHidden-epoch.weights file and gather stats on it
    s->testWeights(fileName.str(), numHidden, 0.05);
  }
}
开发者ID:bmende,项目名称:forest_neural,代码行数:30,代码来源:stats.cpp

示例10: max

 Stats<T> BivarStats<T>::estimateDeviation(const std::vector< std::pair<T, T> >& d) const
 {
    Stats<T> estats;
    size_t max( d.size() );
    for (size_t i=0; i<max; i++)
       estats.Add(std::abs(d[i].second - eval(d[i].first)));
    return estats;
 }
开发者ID:loongfee,项目名称:ossim-svn,代码行数:8,代码来源:BivarStats.hpp

示例11: test_stats2

void test_stats2() {
    // Test singleton pattern
    Stats* stats = Stats::getUniqueInstance();
    assert(stats->get((StatsKey)4) == 2);

    // Test clear()
    stats->clear();
    assert(stats->get((StatsKey)4) == 0);
}
开发者ID:thabz,项目名称:RayGay,代码行数:9,代码来源:teststats.cpp

示例12: DoStatsUptime

	void DoStatsUptime(CommandSource &source)
	{
		Stats *stats = Serialize::GetObject<Stats *>();
		time_t uptime = Anope::CurTime - Anope::StartTime;
		
		source.Reply(_("Current users: \002{0}\002 (\002{1}\002 ops)"), UserListByNick.size(), OperCount);
		source.Reply(_("Maximum users: \002{0}\002 ({1})"), stats->GetMaxUserCount(), Anope::strftime(stats->GetMaxUserTime(), source.GetAccount()));
		source.Reply(_("Services up \002{0}\002."), Anope::Duration(uptime, source.GetAccount()));
	}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例13: onNextCubemap

StereoCubemap* onNextCubemap(CubemapSource* source, StereoCubemap* cubemap)
{
    for (int i = 0; i < cubemap->getEye(0)->getFacesCount(); i++)
    {
        stats.store(StatsUtils::CubemapFace(i));
    }
	stats.store(StatsUtils::Cubemap());
    return cubemap;
}
开发者ID:YunSuk,项目名称:AlloUnity,代码行数:9,代码来源:main.cpp

示例14: main

int main() {
    const int n {5};
    double data[n] {1.2, 2.3, 3.4, 4.5, 5.6};
    Stats stats;
    for (int i = 0; i < n; i++)
        stats.add(data[i]);
    std::cout << "average = " << stats.avg() << " for "
              << stats.n() << " data points" << std::endl;
    return 0;
}
开发者ID:gjbex,项目名称:training-material,代码行数:10,代码来源:stats_main.cpp

示例15: verifyWalk

void verifyWalk(const IBSTuple &tuple, Stats &stat) {
    int32_t v = tuple.get<0>();
    SINVARIANT(v >= 0 && v < 10);
    SINVARIANT(!vw_seen[v]);
    SINVARIANT(tuple.get<1>() == ((v % 2) == 0));
    SINVARIANT(tuple.get<2>() == str(boost::format("%d") % (v * 10)));
    SINVARIANT(stat.count() == 1);
    SINVARIANT(stat.mean() == v*5);
    vw_seen[v] = true;
}
开发者ID:dataseries,项目名称:Lintel,代码行数:10,代码来源:hashtuplestats.cpp


注:本文中的Stats类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。