Skip to content
Snippets Groups Projects
Select Git revision
  • b5f24e3a736e2b7ce11d994bf48a00957a1ec7ff
  • master default protected
  • 72-improve-docs-for_optimal_setup
  • os-path-join
  • develop-GA
  • add-higher-spindown-components
  • v1.3
  • v1.2
  • v1.1.2
  • v1.1.0
  • v1.0.1
11 results

semi_coherent_glitch_search_using_MCMC.py

Blame
    • Gregory Ashton's avatar
      89f200ed
      Renames sftfilepath -> sftfilepattern · 89f200ed
      Gregory Ashton authored
      This renames the input sftfilepath to sftfilepattern and adds
      documentation on how that should be used, i.e. a colon separated list of
      wildstring or exact matches. In globbing for all matches, the colon
      split is added in. sftfilepath is still used by `Writer` since
      an exact path is known.
      89f200ed
      History
      Renames sftfilepath -> sftfilepattern
      Gregory Ashton authored
      This renames the input sftfilepath to sftfilepattern and adds
      documentation on how that should be used, i.e. a colon separated list of
      wildstring or exact matches. In globbing for all matches, the colon
      split is added in. sftfilepath is still used by `Writer` since
      an exact path is known.
    graphics2.cpp 2.91 KiB
    // This file is part of BOINC.
    // http://boinc.berkeley.edu
    // Copyright (C) 2008 University of California
    //
    // BOINC is free software; you can redistribute it and/or modify it
    // under the terms of the GNU Lesser General Public License
    // as published by the Free Software Foundation,
    // either version 3 of the License, or (at your option) any later version.
    //
    // BOINC 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 Lesser General Public License for more details.
    //
    // You should have received a copy of the GNU Lesser General Public License
    // along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
    
    // platform-independent part of graphics library
    //
    
    #ifdef _MSC_VER
    #define strdup _strdup
    #define snprintf _snprintf
    #endif
    
    #include "util.h"
    #include "app_ipc.h"
    #include "shmem.h"
    #include "boinc_api.h"
    #include "graphics2.h"
    
    double boinc_max_fps = 30.;
    double boinc_max_gfx_cpu_frac = 0.2;
        // needs to be fairly low.  Graphics apps run at normal priority,
        // so they can prevent main app from getting any time
    
    bool throttled_app_render(int x, int y, double t) {
        static double total_render_time = 0;
        static double time_until_render = 0;
        static double last_now = 0;
        static double elapsed_time = 0;
        double now, t0, t1, diff, frac;
        bool ok_to_render = true;
    
        now = dtime();
        diff = now - last_now;
        last_now = now;
    
        // ignore interval if negative or more than 1 second
        //
        if ((diff<0) || (diff>1.0)) {
            diff = 0;
        }
    
        // enforce frames/sec restriction
        //
        if (boinc_max_fps) {
            time_until_render -= diff;
            if (time_until_render < 0) {
                time_until_render += 1./boinc_max_fps;
            } else {
                ok_to_render = false;
            }
        }
    
        // enforce max CPU time restriction
        //
        if (boinc_max_gfx_cpu_frac) {
            elapsed_time += diff;
            if (elapsed_time) {