Examples of TickManager


Examples of nallar.tickthreading.minecraft.TickManager

        world = e.worldObj;
      } else {
        world = DimensionManager.getWorld(0);
      }
    }
    final TickManager manager = TickThreading.instance.getManager(world == null ? DimensionManager.getWorld(0) : world);
    final List<World> worlds = new ArrayList<World>();
    if (world == null) {
      Collections.addAll(worlds, DimensionManager.getWorlds());
    } else {
      worlds.add(world);
    }
    final int hashCode = x != null ? TickManager.getHashCode(x * 16, z * 16) : 0;
    if (entity) {
      final EntityTickProfiler entityTickProfiler = EntityTickProfiler.ENTITY_TICK_PROFILER;
      if (location) {
        if (!world.getChunkProvider().chunkExists(x, z)) {
          sendChat(commandSender, "The chunk coords " + x + ',' + z + " are not loaded, can not profile.");
          return;
        }
      }
      if (!entityTickProfiler.startProfiling(new Runnable() {
        @Override
        public void run() {
          if (location) {
            TickRegion tickRegion = manager.getEntityRegion(hashCode);
            if (tickRegion != null) {
              tickRegion.profilingEnabled = false;
            }
            tickRegion = manager.getTileEntityRegion(hashCode);
            if (tickRegion != null) {
              tickRegion.profilingEnabled = false;
            }
          }
          sendChat(commandSender, entityTickProfiler.writeStringData(new TableFormatter(commandSender)).toString());
        }
      }, location ? ProfilingState.CHUNK : ProfilingState.GLOBAL, time, worlds)) {
        sendChat(commandSender, "Someone else is currently profiling.");
      }
      if (location) {
        manager.profilingEnabled = false;
        TickRegion tickRegion = manager.getEntityRegion(hashCode);
        if (tickRegion != null) {
          tickRegion.profilingEnabled = true;
        }
        tickRegion = manager.getTileEntityRegion(hashCode);
        if (tickRegion != null) {
          tickRegion.profilingEnabled = true;
        }
      }
      sendChat(commandSender, "Profiling for " + time + " seconds in " + (world == null ? "all worlds " : Log.name(world)) + (location ? " at chunk coords " + x + ',' + z : ""));
View Full Code Here

Examples of nallar.tickthreading.minecraft.TickManager

        synchronized (EntityTickProfiler.class) {
          endProfiling();
          runnable.run();
          clear();
          for (World world_ : worlds) {
            TickManager tickManager = TickThreading.instance.getManager(world_);
            if (tickManager != null) {
              tickManager.profilingEnabled = false;
            }
          }
        }
View Full Code Here

Examples of nallar.tickthreading.minecraft.TickManager

      sendChat(commandSender, usage());
      return;
    }
    if ("e".equals(type)) {
      TableFormatter tf = new TableFormatter(commandSender);
      TickManager tickManager = TickThreading.instance.getManager(world);
      tickManager.writeEntityStats(tf);
      tf.sb.append('\n');
      tickManager.fixDiscrepancies(tf.sb);
      sendChat(commandSender, String.valueOf(tf));
    } else if ("b".equals(type)) {
      sendChat(commandSender, String.valueOf(((WorldServer) world).writePendingBlockUpdatesStats(new TableFormatter(commandSender))));
    } else if ("t".equals(type)) {
      sendChat(commandSender, String.valueOf(TickThreading.instance.getManager(world).writeDetailedStats(new TableFormatter(commandSender))));
View Full Code Here

Examples of nallar.tickthreading.minecraft.TickManager

    return false;
  }

  @Override
  public void doTick() {
    final TickManager manager = this.manager;
    final boolean check = checkTime++ % 60 == 0;
    final boolean profilingEnabled = manager.profilingEnabled || this.profilingEnabled;
    EntityTickProfiler entityTickProfiler = profilingEnabled ? EntityTickProfiler.ENTITY_TICK_PROFILER : null;
    long startTime = profilingEnabled ? System.nanoTime() : 0;
    final Iterator<TileEntity> tileEntitiesIterator = tileEntitySet.startIteration();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.