暂无描述
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

ClusterInfo.cs 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #if VISUAL_SCRIPTING_ENABLED
  2. using Unity.VisualScripting;
  3. namespace UnityEngine.AdaptivePerformance.VisualScripting
  4. {
  5. [UnitShortTitle("Cluster Info")]
  6. [UnitSubtitle("CPU Core Cluster")]
  7. [UnitCategory("AdaptivePerformance/Performance")]
  8. public class ClusterInfoUnit : Unit
  9. {
  10. [DoNotSerialize]
  11. public ValueOutput bigCore;
  12. [DoNotSerialize]
  13. public ValueOutput mediumCore;
  14. [DoNotSerialize]
  15. public ValueOutput littleCore;
  16. int BigCore = -1;
  17. int MediumCore = -1;
  18. int LittleCore = -1;
  19. protected override void Definition()
  20. {
  21. bigCore = ValueOutput<int>("Big Core", (flow) => { UpdateStats(); return BigCore; });
  22. mediumCore = ValueOutput<int>("Medium Core", (flow) => { UpdateStats(); return MediumCore; });
  23. littleCore = ValueOutput<int>("Little Core", (flow) => { UpdateStats(); return LittleCore; });
  24. }
  25. void UpdateStats()
  26. {
  27. if (Application.isPlaying && Holder.Instance != null)
  28. {
  29. var ci = Holder.Instance.PerformanceStatus.PerformanceMetrics.ClusterInfo;
  30. BigCore = ci.BigCore;
  31. MediumCore = ci.MediumCore;
  32. LittleCore = ci.LittleCore;
  33. }
  34. }
  35. }
  36. }
  37. #endif