Example #1
0
// Performance test.
void performance(char *fileName, fiftyoneDegreesWorksetPool *pool) {
	double totalSec, calibration, test;
	int memoryUsed;
	PERFORMANCE_STATE state;

	state.pool = pool;
	state.fileName = fileName;
#ifndef FIFTYONEDEGREES_NO_THREADING
	FIFTYONEDEGREES_MUTEX_CREATE(state.lock);
#endif

	state.test = "Caching Data";
	state.calibrate = 1;
	state.max = 0;
	state.numberOfThreads = 1;
	state.passes = 1;
	performTest(&state);

	state.numberOfThreads = THREAD_COUNT;
	state.max = state.count * state.numberOfThreads;
	state.passes = PASSES;
	state.test = "Calibrate";
	calibration = performTest(&state);
	state.test = "Detection test";
	state.calibrate = 0;
	test = performTest(&state);

	// Get the memory needed for a provider.
	memoryUsed = (int)fiftyoneDegreesGetProviderSizeWithPropertyCount(pool->dataSet->fileName, (int)pool->dataSet->requiredPropertyCount, (int)pool->size, (int)pool->cache->total);
	memoryUsed = memoryUsed / 1048576;

	// Time to complete.
	totalSec = test - calibration;
	printf("Number of records per iteration: %i s\n", state.count);
	printf("Average detection time for total data set: %.2f s\n", totalSec);
	printf("Average number of detections per second per thread: %.2f\n", (double)state.max / totalSec / (double)state.numberOfThreads);
	printf("Average milliseconds per detection: %.6f\n", (totalSec * (double)1000) / (double)state.max);
	printf("Memory used by a provider initialised with the given arguments: %d Mb\n", memoryUsed);
	if (pool->cache != NULL) {
		printf("Cache hits: %d\n", pool->cache->hits);
		printf("Cache misses: %d\n", pool->cache->misses);
		printf("Cache switches: %d\n", pool->cache->switches);
	}

#ifndef FIFTYONEDEGREES_NO_THREADING
	FIFTYONEDEGREES_MUTEX_CLOSE(state.lock);
#endif

	// Wait for a character to be pressed.
	fgetc(stdin);
}
Example #2
0
// Performance test.
void performance(char *fileName, fiftyoneDegreesWorksetPool *pool) {
	double totalSec, calibration, test;
	PERFORMANCE_STATE state;

	state.pool = pool;
	state.fileName = fileName;
#ifndef FIFTYONEDEGREES_NO_THREADING
	FIFTYONEDEGREES_MUTEX_CREATE(state.lock);
#endif

	state.test = "Caching Data";
	state.calibrate = 1;
	state.max = 0;
	state.numberOfThreads = 1;
	state.passes = 1;
	performTest(&state);

	state.numberOfThreads = THREAD_COUNT;
	state.max = state.count * state.numberOfThreads;
	state.passes = PASSES;
	state.test = "Calibrate";
	calibration = performTest(&state);
	state.test = "Detection test";
	state.calibrate = 0;
	test = performTest(&state);

	// Time to complete.
	totalSec = test - calibration;
	printf("Average detection time for total data set: %.2f s\n", totalSec);
	printf("Average number of detections per second per thread: %.2f\n", (double)state.max / totalSec / (double)state.numberOfThreads);
	printf("Average milliseconds per detection: %.6f\n", (totalSec * (double)1000) / (double)state.max / (double)state.numberOfThreads);
	if (pool->cache != NULL) {
		printf("Cache hits: %d\n", pool->cache->hits);
		printf("Cache misses: %d\n", pool->cache->misses);
		printf("Cache switches: %d\n", pool->cache->switches);
	}

#ifndef FIFTYONEDEGREES_NO_THREADING
	FIFTYONEDEGREES_MUTEX_CLOSE(state.lock);
#endif

	// Wait for a character to be pressed.
	fgetc(stdin);
}
Example #3
0
FormEditAccount::FormEditAccount(QWidget *parent)
  : QDialog(parent), m_ui(new Ui::FormEditAccount), m_editableRoot(nullptr) {
  m_ui->setupUi(this);
  m_btnOk = m_ui->m_buttonBox->button(QDialogButtonBox::Ok);

  setWindowFlags(Qt::MSWindowsFixedSizeDialogHint | Qt::Dialog | Qt::WindowSystemMenuHint);
  setWindowIcon(qApp->icons()->fromTheme(QSL("tinytinyrss")));

  m_ui->m_lblServerSideUpdateInformation->setText(tr("Leaving this option on causes that updates "
                                                     "of feeds will be probably much slower and may time-out often."));
  m_ui->m_lblDescription->setText(tr("Note that at least API level %1 is required.").arg(MINIMAL_API_LEVEL));
  m_ui->m_txtHttpUsername->lineEdit()->setPlaceholderText(tr("HTTP authentication username"));
  m_ui->m_txtHttpPassword->lineEdit()->setPlaceholderText(tr("HTTP authentication password"));
  m_ui->m_txtPassword->lineEdit()->setPlaceholderText(tr("Password for your TT-RSS account"));
  m_ui->m_txtUsername->lineEdit()->setPlaceholderText(tr("Username for your TT-RSS account"));
  m_ui->m_txtUrl->lineEdit()->setPlaceholderText(tr("FULL URL of your TT-RSS instance WITH trailing \"/api/\" string"));
  m_ui->m_lblTestResult->setStatus(WidgetWithStatus::Information,
                                   tr("No test done yet."),
                                   tr("Here, results of connection test are shown."));

  setTabOrder(m_ui->m_txtUrl->lineEdit(), m_ui->m_checkServerSideUpdate);
  setTabOrder(m_ui->m_checkServerSideUpdate, m_ui->m_txtUsername->lineEdit());
  setTabOrder(m_ui->m_txtUsername->lineEdit(), m_ui->m_txtPassword->lineEdit());
  setTabOrder(m_ui->m_txtPassword->lineEdit(), m_ui->m_checkShowPassword);
  setTabOrder(m_ui->m_checkShowPassword, m_ui->m_gbHttpAuthentication);
  setTabOrder(m_ui->m_gbHttpAuthentication, m_ui->m_txtHttpUsername->lineEdit());
  setTabOrder(m_ui->m_txtHttpUsername->lineEdit(), m_ui->m_txtHttpPassword->lineEdit());
  setTabOrder(m_ui->m_txtHttpPassword->lineEdit(), m_ui->m_checkShowHttpPassword);
  setTabOrder(m_ui->m_checkShowHttpPassword, m_ui->m_btnTestSetup);
  setTabOrder(m_ui->m_btnTestSetup, m_ui->m_buttonBox);

  connect(m_ui->m_checkShowPassword, SIGNAL(toggled(bool)), this, SLOT(displayPassword(bool)));
  connect(m_ui->m_buttonBox, SIGNAL(accepted()), this, SLOT(onClickedOk()));
  connect(m_ui->m_buttonBox, SIGNAL(rejected()), this, SLOT(onClickedCancel()));
  connect(m_ui->m_txtPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onPasswordChanged()));
  connect(m_ui->m_txtUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onUsernameChanged()));
  connect(m_ui->m_txtHttpPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onHttpPasswordChanged()));
  connect(m_ui->m_txtHttpUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onHttpUsernameChanged()));
  connect(m_ui->m_txtUrl->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(onUrlChanged()));
  connect(m_ui->m_txtPassword->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton()));
  connect(m_ui->m_txtUsername->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton()));
  connect(m_ui->m_txtUrl->lineEdit(), SIGNAL(textChanged(QString)), this, SLOT(checkOkButton()));
  connect(m_ui->m_btnTestSetup, SIGNAL(clicked()), this, SLOT(performTest()));
  connect(m_ui->m_gbHttpAuthentication, SIGNAL(toggled(bool)), this, SLOT(onHttpPasswordChanged()));
  connect(m_ui->m_gbHttpAuthentication, SIGNAL(toggled(bool)), this, SLOT(onHttpUsernameChanged()));
  connect(m_ui->m_checkShowHttpPassword, SIGNAL(toggled(bool)), this, SLOT(displayHttpPassword(bool)));

  onPasswordChanged();
  onUsernameChanged();
  onUrlChanged();
  onHttpPasswordChanged();
  onHttpUsernameChanged();
  checkOkButton();
  displayPassword(false);
  displayHttpPassword(false);
}
int main(int argc, char **argv)
{
    bool installMode;
#ifdef TESTMODE
    bool testMode = false;
#endif

    if (argc != 2)
    {
        displayHelpAndExit(argv[0]);
    }
    if (strcmp(argv[1], "install") == 0)
    {
        installMode = true;
    } else
    if (strcmp(argv[1], "uninstall") == 0)
    {
        installMode = false;
    } else
#ifdef TESTMODE
    if (strcmp(argv[1], "test") == 0)
    {
        testMode = true;
    } else
#endif
    {
        displayHelpAndExit(argv[0]);
    }

    int rc;

#ifdef TESTMODE
    if (testMode)
    {
        rc = performTest();
    } else
#endif
    if (installMode)
    {
        rc = installDriver();
    } else
    {
        rc = uninstallDriver();
    }

    if (rc == 0)
    {
        printf("operation completed successfully!\n");
    } else
    {
        printf("error: operation failed with status code %d\n", rc);
    }

    return rc;
}
QString TestManager::execute(TestLevel level, LatexEditorView* edView, QCodeEdit* codeedit, QEditor* editor, BuildManager* buildManager){
	QTemporaryFile tf;
	tf.setAutoRemove(false);
	tf.open();
	QByteArray tfn = QFile::encodeName(tf.fileName());
	tf.close();
	tempResult = tfn.data();
	
	
	//codeedit, editor are passed as extra parameters and not extracted from edView, so we don't have
	//to include latexeditorview.h here
	totalTestTime = 0;
	QString tr;
	QList<QObject*> tests=QList<QObject*>()
        << new SmallUsefulFunctionsTest()
		<< new BuildManagerTest(buildManager)
		<< new CodeSnippetTest(editor)
		<< new QDocumentLineTest()
		<< new QDocumentCursorTest()
		<< new QDocumentSearchTest(editor,level==TL_ALL)
		<< new QSearchReplacePanelTest(codeedit,level==TL_ALL)
		<< new QEditorTest(editor,level==TL_ALL)
		<< new LatexEditorViewTest(edView)
		<< new LatexCompleterTest(edView)
		<< new ScriptEngineTest(edView,level==TL_ALL)
		<< new LatexEditorViewBenchmark(edView,level==TL_ALL)
		<< new StructureViewTest(edView,edView->document,level==TL_ALL)
		<< new TableManipulationTest(editor)
		<< new SyntaxCheckTest(edView)
		<< new UpdateCheckerTest(level==TL_ALL)
		<< new HelpTest();
	bool allPassed=true;
	if (level!=TL_ALL)
		tr="There are skipped tests. Please rerun with --execute-all-tests\n\n";
	for (int i=0; i <tests.size();i++){
		emit newMessage(tests[i]->metaObject()->className());
		QString res=performTest(tests[i]);
		tr+=res;
		if (!res.contains(", 0 failed, 0 skipped")) allPassed=false;
	}	
	
	tr+=QString("\nTotal testing time: %1 ms\n").arg(totalTestTime);
	
	if (!allPassed)
		tr="*** THERE SEEM TO BE FAILED TESTS! ***\n\n\n\n"+tr;
	
	QFile(QFile::decodeName(tempResult)).remove();
	
	return tr;
}
Example #6
0
void GUITestLauncher::run() {

    if (!initGUITestBase()) {
        return;
    }

    int finishedCount = 0;
    foreach(HI::GUITest* t, tests) {
        if (isCanceled()) {
            return;
        }

        Q_ASSERT(t);
        if (t) {
            QString testName = t->getFullName();
            QString testNameForTeamCity = t->getSuite() +"_"+ t->getName();
            results[testName] = "";

            firstTestRunCheck(testName);

            if (!t->isIgnored()) {
                qint64 startTime = GTimer::currentTimeMicros();
                GUITestTeamcityLogger::testStarted(testNameForTeamCity);

                QString testResult = performTest(testName);
                results[testName] = testResult;
                if (GUITestTeamcityLogger::testFailed(testResult)) {
                    renameTestLog(testName);
                }

                qint64 finishTime = GTimer::currentTimeMicros();
                GUITestTeamcityLogger::teamCityLogResult(testNameForTeamCity, testResult, GTimer::millisBetween(startTime, finishTime));
            }
            else if(t->getReason() == HI::GUITest::Bug){
                GUITestTeamcityLogger::testIgnored(testNameForTeamCity, t->getIgnoreMessage());
            }
        }

        updateProgress(finishedCount++);
    }
}
Example #7
0
int main () {

    unsigned int C, Vn;
    unsigned long long En;

    fscanf(stdin, "%u", &C);

    while (C--) {
        eMemCount = 0;
        fscanf(stdin, "%u %llu", &Vn, &En);

        Graph *g = new Graph(Vn);

        while (En--) {
            unsigned int fromNode, toNode;
            fscanf(stdin, "%u %u", &fromNode, &toNode);
            g->addEdge(fromNode, toNode);

        }

        unsigned int D;
        fscanf(stdin, "%u", &D);
        unsigned int* zapytania = new unsigned int[D];
        for(unsigned int i = 0; i < D; i++) {
            fscanf(stdin, "%u", &(zapytania[i]));
        }
        for(unsigned int fromIndex = 0; fromIndex < D; fromIndex++) {
            for(unsigned int toIndex = fromIndex+1; toIndex < D; toIndex++) {
                performTest(g, zapytania[fromIndex], zapytania[toIndex]);
            }
        }

        fprintf(stdout, "%llu\n", minD);
        minD = INT_MAX;
        delete g;
        delete[] zapytania;
    }

    return 0;
}
int main(int argc, char **argv)
{
    bool installMode;
#ifdef TESTMODE
    bool testMode = false;
#endif

    if (argc != 2)
        return usage(argv[0]);

    if (strcmp(argv[1], "install") == 0)
        installMode = true;
    else if (strcmp(argv[1], "uninstall") == 0)
        installMode = false;
#ifdef TESTMODE
    else if (strcmp(argv[1], "test") == 0)
        testMode = true;
#endif
    else
        return usage(argv[0]);


    int rc;
#ifdef TESTMODE
    if (testMode)
        rc = performTest();
    else
#endif
    if (installMode)
        rc = installDriver();
    else
        rc = uninstallDriver();

    if (rc == 0)
        printf("operation completed successfully!\n");
    else
        printf("error: operation failed with status code %d\n", rc);

    return rc;
}
Example #9
0
long FXCY_Diagnosis::onCmdNewTest(FXObject*,FXSelector sel,void*){
  performTest();
  return 1;
}
// actual test application
int main(int argc, char **argv)
{
  // init ROS
  ros::init(argc, argv, "pr2_multi_vel_test");
  ros::NodeHandle n_("~");

  // advertise joint velocity command
  ros::Publisher qdot_des_pub_ = n_.advertise<std_msgs::Float64MultiArray>("multi_vel_command", 1);

  // construct RobotArm object...
  RobotArm arm(n_);
  // ...init it
  ROS_INFO("Init of arm action interface...");
  if(!arm.init())
    return 0;

  // activate standard controller to go to desired configuration
  ROS_INFO("Starting standard arm controllers...");
  ros::Duration(0.5).sleep();
  if(!arm.startControllerPlugin())
    return 0;

  // ... use it to go the initial joint configuration
  ROS_INFO("Going to desired initial configuration...");
  if(!arm.gotoDesiredConfiguration())
    return 0;

  // ... and deactivate the standard controller
  ROS_INFO("Stopping standard arm controllers...");
  if(!arm.stopControllerPlugin())
    return 0;
  
  // get controller namespace and desired test parameters from parameter server
  std::string joint_to_test_;
  double joint_velocity_, test_time_;
  int joint_index_;
  std::string vel_controller_ns_;

  if(!retrieveParameter(n_, "", "vel_controller_namespace", vel_controller_ns_))
    return 0;
  if(!retrieveParameter(n_, vel_controller_ns_, "joint_to_test", joint_to_test_))
    return 0;
  if(!retrieveParameter(n_, vel_controller_ns_, "joint_index", joint_index_))
    return 0;
  if(!retrieveParameter(n_, vel_controller_ns_, "joint_velocity", joint_velocity_))
    return 0;
  if(!retrieveParameter(n_, vel_controller_ns_, "test_time", test_time_))
    return 0;

  // start test with user questions
  performTest(qdot_des_pub_, joint_to_test_, joint_index_, joint_velocity_, test_time_);
  printAndSleep(5.0);

  // restart standard controller to be nice
  ROS_INFO("Re-starting standard arm controllers...");
  if(!arm.startControllerPlugin())
    return 0;

  // exit
  return 0;
}
bool SpectralAnalysisTest::performTest()
{
    return performTest(50, 10) && performTest(52, 10) && performTest(52, 11);
}