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


C++ Performance类代码示例

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


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

示例1: error

void PerformanceManager::loadPerformances() {

	IffStream* iffStream = TemplateManager::instance()->openIffFile(
			"datatables/performance/performance.iff");

	if (iffStream == NULL) {
		error("Could not open performances datatable.");
		return;
	}

	DataTableIff dtable;
	dtable.readObject(iffStream);

	delete iffStream;

	performances = new Vector<Performance*> ();
	for (int i = 0; i < dtable.getTotalRows(); ++i) {
		DataTableRow* row = dtable.getRow(i);

		Performance* performance = new Performance();
		performance->parseDataTableRow(row);
		performances->add(performance);
	}

	info("Loaded " + String::valueOf(performances->size()) + " performances.",
			true);
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:27,代码来源:PerformanceManager.cpp

示例2: getInstrument

Vector<Performance*> PerformanceManager::getPerformanceListFromMod(
		const String& requiredSkillMod, int playerSkillModValue, int instrument) {
	String instrumentName = "";
	if (instrument != 0)
		instrumentName = getInstrument(instrument);

	Vector<Performance*> performanceList;

	if (performances != NULL) {

		for (int i = 0; i < performances->size(); ++i) {
			Performance* perform = performances->get(i);
			if (perform->getRequiredSkillMod() == requiredSkillMod
					&& perform->getRequiredSkillModValue()
							<= playerSkillModValue) {
				if (instrumentName != "") {
					//Should be a music call, look only for performances with that instrument
					if (instrumentName == perform->getRequiredInstrument())
						performanceList.add(perform);
				} else {
					//Should be a dance call
					performanceList.add(perform);
				}
			}
		}

	}

	return performanceList;
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:30,代码来源:PerformanceManager.cpp

示例3: run

void run() {
	Performance p;

	printf("Allocating buffers\n");

	text_buf = alloc_shared_buffer<char> (LENGTH_OF_TEXT, &text_c);
	pattern_buf= alloc_shared_buffer<char> (LENGTH_OF_PATTERN, &pattern_c);
	result_buf= alloc_shared_buffer<char> (1, &result_c);
	result_c[0] = 0;

	init_string( text_c, pattern_c );

	printf("Initializing kernels\n");
	size_t task_dim = 1;
	clKernelSet kernel_set (device, context, program);
//	kernel_set.addKernel ("text_processor", 1, &task_dim, text_buf, LENGTH_OF_TEXT);
//	kernel_set.addKernel ("word_processor", 1, &task_dim);
	kernel_set.addKernel ("word_processor", 1, &task_dim, text_buf, LENGTH_OF_TEXT);
	kernel_set.addKernel ("matching", 1, &task_dim, pattern_buf, LENGTH_OF_PATTERN, result_buf);

	printf("Launching the kernel...\n");
	p.start();
	kernel_set.launch();

	printf(" start waiting.... \n");
	kernel_set.finish();


	p.stop();
	printf(" done Execution (OpenCL Channel) time = (%u,%u), result = %d\n", p.report_sec(), p.report_usec(),result_c[0]);

	test_in_cpu( text_c, pattern_c );

	return;
}
开发者ID:mapleelpam,项目名称:openCL-string-compare,代码行数:35,代码来源:main.cpp

示例4: webkitClearMeasuresCallback

static v8::Handle<v8::Value> webkitClearMeasuresCallback(const v8::Arguments& args)
{
    Performance* imp = V8Performance::toNative(args.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, measureName, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsNullString));
    imp->webkitClearMeasures(measureName);
    return v8Undefined();
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8Performance.cpp

示例5: onwebkitresourcetimingbufferfullAttrSetter

static void onwebkitresourcetimingbufferfullAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    Performance* imp = V8Performance::toNative(info.Holder());
    transferHiddenDependency(info.Holder(), imp->onwebkitresourcetimingbufferfull(), value, V8Performance::eventListenerCacheIndex);
    imp->setOnwebkitresourcetimingbufferfull(V8DOMWrapper::getEventListener(value, true, ListenerFindOrCreate));
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8Performance.cpp

示例6: webkitGetEntriesByTypeCallback

static v8::Handle<v8::Value> webkitGetEntriesByTypeCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    Performance* imp = V8Performance::toNative(args.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, entryType, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    return toV8(imp->webkitGetEntriesByType(entryType), args.Holder(), args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:8,代码来源:V8Performance.cpp

示例7: webkitSetResourceTimingBufferSizeCallback

static v8::Handle<v8::Value> webkitSetResourceTimingBufferSizeCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    Performance* imp = V8Performance::toNative(args.Holder());
    V8TRYCATCH(unsigned, maxSize, toUInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)));
    imp->webkitSetResourceTimingBufferSize(maxSize);
    return v8Undefined();
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:9,代码来源:V8Performance.cpp

示例8: main

int main()
{
	Performance P; //Initializes an instance of the Performance class.
	P.run(2,20); //first parameter is the number of standard deviations for bands. 
				 //Second parameter is the number of periods in the moving average.
	cout<< "Sharpe Ratio: " << P.sharpe_ratio() << endl;
	
	system("pause");
}
开发者ID:JiayangLi,项目名称:Bollinger_Bands,代码行数:9,代码来源:main.cpp

示例9: glDepthMask

//-----------------------------------------------------------------------------
//! 描画
//-----------------------------------------------------------------------------
void SystemPerformance::drawPerformanceBar()
{

	glDepthMask(GL_FALSE);
	setBlendMode(BM_BLEND_ALPHA);

	// 描画座標
	Vector3 drawPos = Vector3(1860.0f, 0.0f, 0.0f);

	// フレームの数
	static u32 frameCount = 3;
	// 線形補完する
	static f32 height = 1000.0f;
	// 1フレーム分の高さ
	static f32 oneFrameHeight = height / (f32)frameCount;
	

	// 枠を描画
	glColor4f(0.0f,0.0f,0.0f, 0.8f);
	glBegin(GL_TRIANGLE_STRIP);
		glVertex3f(drawPos._x	     , drawPos._y	 	  , 0.0f);
		glVertex3f(drawPos._x + 40.0f, drawPos._y		  , 0.0f);
		glVertex3f(drawPos._x		 , drawPos._y + height, 0.0f);
		glVertex3f(drawPos._x + 40.0f, drawPos._y + height, 0.0f);
	glEnd();

	// 枠の分だけずらす
	drawPos._x += 5.0f;

	

	// 描画
	for( list<Performance*>::iterator itr = _pPerformList.begin(); itr != _pPerformList.end(); itr++ )
	{
		Performance*	drawPef = *itr;
		// 描画
		drawPef->DrawPerformance(drawPos, oneFrameHeight, _maxSecond);
		// 次の描画位置を求める
		drawPos._y += drawPef->getHeight();
	}

	//---- フレームの分割線の描画
	drawPos._x -= 5.0f;
	glBegin(GL_LINES);
	glColor4f(0.0f, 1.0f, 0.5f, 1.0f);
	for( u32 i=0; i<frameCount; ++i ){
		glVertex3f(drawPos._x		 , i * oneFrameHeight, 0.0f);
		glVertex3f(drawPos._x + 40.0f, i * oneFrameHeight, 0.0f);
	}
	glEnd();

	// 白で設定しなおす
	glColor4f(1.0f, 1.0f, 1.0f, 1.0f);

	setBlendMode(BM_NONE);
	glDepthMask(GL_TRUE);
}
开发者ID:EKISUKE,项目名称:GitHubTest,代码行数:60,代码来源:gmTimer.cpp

示例10: getSong

Performance* PerformanceManager::getSong(const String& name, int instrumentType) {
	if (performances != NULL) {
		for (int i = 0; i < performances->size(); ++i) {
			Performance* ret = performances->get(i);

			if (ret->isMusic() && ret->getName() == name
					&& ret->getInstrumentAudioId() == instrumentType)
				return ret;
		}
	}
	return NULL;
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:12,代码来源:PerformanceManager.cpp

示例11: getDance

Performance* PerformanceManager::getDance(const String& name) {
	if (performances != NULL) {
		for (int i = 0; i < performances->size(); ++i) {
			Performance* ret = performances->get(i);

			if (ret->isDance() && ret->getName() == name)
				return ret;
		}
	}

	return NULL;
}
开发者ID:Chilastra-Reborn,项目名称:Core3,代码行数:12,代码来源:PerformanceManager.cpp

示例12: memoryAttrGetter

static v8::Handle<v8::Value> memoryAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    Performance* imp = V8Performance::toNative(info.Holder());
    RefPtr<MemoryInfo> result = imp->memory();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "memory", wrapper);
    }
    return wrapper;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:12,代码来源:V8Performance.cpp

示例13: locker

void EntertainingSessionImplementation::doPerformanceAction() {
	ManagedReference<CreatureObject*> entertainer = this->entertainer.get();

	if (entertainer == NULL)
		return;

	Locker locker(entertainer);

	Performance* performance = NULL;

	PerformanceManager* performanceManager = SkillManager::instance()->getPerformanceManager();
	ManagedReference<Instrument*> instrument = getInstrument(entertainer);

	if (isDancing())
		performance = performanceManager->getDance(performanceName);
	else if (isPlayingMusic() && instrument)
		performance = performanceManager->getSong(performanceName, instrument->getInstrumentType());
	else {
		cancelSession();
		return;
	}

	if (performance == NULL) { // shouldn't happen
		StringBuffer msg;
		msg << "Performance was null.  Please report to www.swgemu.com/bugs ! Name: " << performanceName << " and Type: " << dec << instrument->getInstrumentType();

		entertainer->sendSystemMessage(msg.toString());
		return;
	}

	int actionDrain = performance->getActionPointsPerLoop();

	//Adjust cost based upon player's quickness
	actionDrain = entertainer->calculateCostAdjustment(CreatureAttribute::QUICKNESS, actionDrain);

	if (entertainer->getHAM(CreatureAttribute::ACTION) <= actionDrain) {
		if (isDancing()) {
			stopDancing();
			entertainer->sendSystemMessage("@performance:dance_too_tired");
		}

		if (isPlayingMusic()) {
			stopPlayingMusic();
			entertainer->sendSystemMessage("@performance:music_too_tired");
		}
	} else {
		entertainer->inflictDamage(entertainer, CreatureAttribute::ACTION, actionDrain, false, true);
	}
}
开发者ID:KiritoShadowfang,项目名称:Core3,代码行数:49,代码来源:EntertainingSessionImplementation.cpp

示例14: TotalPlayTime

already_AddRefed<VideoPlaybackQuality>
HTMLVideoElement::GetVideoPlaybackQuality() {
  DOMHighResTimeStamp creationTime = 0;
  uint32_t totalFrames = 0;
  uint32_t droppedFrames = 0;
  uint32_t corruptedFrames = 0;

  if (IsVideoStatsEnabled()) {
    if (nsPIDOMWindowInner* window = OwnerDoc()->GetInnerWindow()) {
      Performance* perf = window->GetPerformance();
      if (perf) {
        creationTime = perf->Now();
      }
    }

    if (mDecoder) {
      if (nsContentUtils::ShouldResistFingerprinting(OwnerDoc())) {
        totalFrames = nsRFPService::GetSpoofedTotalFrames(TotalPlayTime());
        droppedFrames = nsRFPService::GetSpoofedDroppedFrames(
            TotalPlayTime(), VideoWidth(), VideoHeight());
        corruptedFrames = 0;
      } else {
        FrameStatistics* stats = &mDecoder->GetFrameStatistics();
        if (sizeof(totalFrames) >= sizeof(stats->GetParsedFrames())) {
          totalFrames = stats->GetTotalFrames();
          droppedFrames = stats->GetDroppedFrames();
        } else {
          uint64_t total = stats->GetTotalFrames();
          const auto maxNumber = std::numeric_limits<uint32_t>::max();
          if (total <= maxNumber) {
            totalFrames = uint32_t(total);
            droppedFrames = uint32_t(stats->GetDroppedFrames());
          } else {
            // Too big number(s) -> Resize everything to fit in 32 bits.
            double ratio = double(maxNumber) / double(total);
            totalFrames = maxNumber;  // === total * ratio
            droppedFrames = uint32_t(double(stats->GetDroppedFrames()) * ratio);
          }
        }
        corruptedFrames = 0;
      }
    }
  }

  RefPtr<VideoPlaybackQuality> playbackQuality = new VideoPlaybackQuality(
      this, creationTime, totalFrames, droppedFrames, corruptedFrames);
  return playbackQuality.forget();
}
开发者ID:jld,项目名称:gecko-dev,代码行数:48,代码来源:HTMLVideoElement.cpp

示例15: webkitMarkCallback

static v8::Handle<v8::Value> webkitMarkCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    Performance* imp = V8Performance::toNative(args.Holder());
    ExceptionCode ec = 0;
    {
    V8TRYCATCH_FOR_V8STRINGRESOURCE(V8StringResource<>, markName, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined));
    imp->webkitMark(markName, ec);
    if (UNLIKELY(ec))
        goto fail;
    return v8Undefined();
    }
    fail:
    return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:16,代码来源:V8Performance.cpp


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