Ejemplo n.º 1
0
  // stop an entry
  public static void Stop(string e_name)
  {
    if (instance == null) return;

    entry e = instance.entries[e_name];

    ++e.calls;
    e.time += Lib.Clocks() - e.start;
  }
Ejemplo n.º 2
0
  // start an entry
  public static void Start(string e_name)
  {
    if (instance == null) return;

    if (!instance.entries.ContainsKey(e_name)) instance.entries.Add(e_name, new entry());

    entry e = instance.entries[e_name];
    e.start = Lib.Clocks();
  }
Ejemplo n.º 3
0
		/// <summary> Stop a profiler entry. </summary>
		public static void Stop(string e_name)
		{
#if DEBUG_PROFILER
			if (Fetch == null)
				return;

			Entry e = Fetch.entries[e_name];

			++e.calls;
			e.time += Lib.Clocks() - e.start;
#endif
		}
Ejemplo n.º 4
0
		/// <summary> Start a profiler entry. </summary>
		public static void Start(string e_name)
		{
#if DEBUG_PROFILER
			if (Fetch == null)
				return;

			if (!Fetch.entries.ContainsKey(e_name))
			{
				Fetch.entries.Add(e_name, new Entry());
				Fetch.AddDialogItem(e_name);
			}

			Fetch.entries[e_name].start = Lib.Clocks();
#endif
		}
Ejemplo n.º 5
0
		private void Update()
		{
			if ((Input.GetKey(KeyCode.LeftControl) || Input.GetKey(KeyCode.RightControl)) &&
					 Input.GetKeyUp(KeyCode.P) && popup_dialog != null)
			{
				visible = !visible;
				popup_dialog.gameObject.SetActive(visible);
			}

			// skip updates for a smoother display
			if (((Lib.Clocks() - update_timer) > timeout) && visible)
			{
				update_timer = Lib.Clocks();
				Calculate();
			}
		}
Ejemplo n.º 6
0
        // do the particle-fitting in another thread
        public static void Preprocess()
        {
            // deduce number of particles
            int inner_count = 150000;
            int outer_count = 600000;
            int pause_count = 250000;

            if (Settings.LowQualityRendering)
            {
                inner_count /= 5;
                outer_count /= 5;
                pause_count /= 5;
            }

            // start time
            UInt64 time = Lib.Clocks();

            // create all magnetic fields and do particle-fitting
            List <string> done = new List <string>();

            foreach (var pair in models)
            {
                // get radiation data
                RadiationModel mf = pair.Value;

                // skip if model is already done
                if (done.Contains(mf.name))
                {
                    continue;
                }

                // add to the skip list
                done.Add(mf.name);

                // if it has a field
                if (mf.Has_field())
                {
                    // some feedback in the log
                    // note: can't use BuildString here, as it is not thread-safe
                    Lib.Log("particle-fitting '" + mf.name + "'...");
                }

                // particle-fitting for the inner radiation belt
                if (mf.has_inner)
                {
                    mf.inner_pmesh = new ParticleMesh(mf.Inner_func, mf.Inner_domain(), mf.Inner_offset(), inner_count, mf.inner_quality);
                }

                // particle-fitting for the outer radiation belt
                if (mf.has_outer)
                {
                    mf.outer_pmesh = new ParticleMesh(mf.Outer_func, mf.Outer_domain(), mf.Outer_offset(), outer_count, mf.outer_quality);
                }

                // particle-fitting for the magnetopause
                if (mf.has_pause)
                {
                    mf.pause_pmesh = new ParticleMesh(mf.Pause_func, mf.Pause_domain(), mf.Pause_offset(), pause_count, mf.pause_quality);
                }
            }

            // measure time required
            // note: can't use BuildString here, as it is not thread-safe
            Lib.Log("particle-fitting completed in " + Lib.Seconds(Lib.Clocks() - time).ToString("F3") + " seconds");
        }