<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ja">
	<id>https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=Xamarin.Mac%2F%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AE%E3%83%A1%E3%83%A2%E3%83%AA%E4%BD%BF%E7%94%A8%E9%87%8F%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B</id>
	<title>Xamarin.Mac/アプリのメモリ使用量を取得する - 版の履歴</title>
	<link rel="self" type="application/atom+xml" href="https://monobook.org/w/index.php?action=history&amp;feed=atom&amp;title=Xamarin.Mac%2F%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AE%E3%83%A1%E3%83%A2%E3%83%AA%E4%BD%BF%E7%94%A8%E9%87%8F%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B"/>
	<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac/%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AE%E3%83%A1%E3%83%A2%E3%83%AA%E4%BD%BF%E7%94%A8%E9%87%8F%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B&amp;action=history"/>
	<updated>2026-06-06T08:53:13Z</updated>
	<subtitle>このウィキのこのページに関する変更履歴</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>https://monobook.org/w/index.php?title=Xamarin.Mac/%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AE%E3%83%A1%E3%83%A2%E3%83%AA%E4%BD%BF%E7%94%A8%E9%87%8F%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B&amp;diff=8366&amp;oldid=prev</id>
		<title>108.162.226.154: ページの作成:「 IOKitからSMCを制御するために「mach_task_self()」「task_info()」周りの使い方をググっていて拾った。 *  http://spiratesta.hatenab...」</title>
		<link rel="alternate" type="text/html" href="https://monobook.org/w/index.php?title=Xamarin.Mac/%E3%82%A2%E3%83%97%E3%83%AA%E3%81%AE%E3%83%A1%E3%83%A2%E3%83%AA%E4%BD%BF%E7%94%A8%E9%87%8F%E3%82%92%E5%8F%96%E5%BE%97%E3%81%99%E3%82%8B&amp;diff=8366&amp;oldid=prev"/>
		<updated>2016-11-14T08:02:43Z</updated>

		<summary type="html">&lt;p&gt;ページの作成:「 &lt;a href=&quot;/wiki/IOKit&quot; title=&quot;IOKit&quot;&gt;IOKit&lt;/a&gt;から&lt;a href=&quot;/w/index.php?title=SMC&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;「SMC」 (存在しないページ)&quot;&gt;SMC&lt;/a&gt;を制御するために「mach_task_self()」「task_info()」周りの使い方を&lt;a href=&quot;/wiki/%E3%82%B0%E3%82%B0%E3%81%A3%E3%81%A6&quot; class=&quot;mw-redirect&quot; title=&quot;ググって&quot;&gt;ググって&lt;/a&gt;いて拾った。 *  http://spiratesta.hatenab...」&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新規ページ&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
[[IOKit]]から[[SMC]]を制御するために「mach_task_self()」「task_info()」周りの使い方を[[ググって]]いて拾った。&lt;br /&gt;
*  http://spiratesta.hatenablog.com/entry/2014/05/08/175006&lt;br /&gt;
&lt;br /&gt;
オリジナルは[[Xamarin.iOS]]でのパフォーマンス測定目的らしいが、そのまま[[コピペ]]で[[Xamarin.Mac]]でも問題なく動いている。&lt;br /&gt;
そんなことより「/Sysytem/Library/Framework」だけではなく「/usr/lib/system」の中にも色々と渋いライブラリがいっぱいあることを知ったことが収穫だ。&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;csharp&amp;quot;&amp;gt;&lt;br /&gt;
using System;&lt;br /&gt;
using System.Runtime.InteropServices;&lt;br /&gt;
using AppKit;&lt;br /&gt;
&lt;br /&gt;
namespace MemoryInfo&lt;br /&gt;
{&lt;br /&gt;
    static class MainClass&lt;br /&gt;
    {&lt;br /&gt;
        public const int TASK_BASIC_INFO = 4;&lt;br /&gt;
&lt;br /&gt;
        [StructLayout(LayoutKind.Sequential, Pack=1)]&lt;br /&gt;
        public struct TimeValue&lt;br /&gt;
        {&lt;br /&gt;
            public int Seconds;&lt;br /&gt;
            public int Microseconds;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        [StructLayout(LayoutKind.Sequential, Pack = 1)]&lt;br /&gt;
        public struct TaskBasicInfo&lt;br /&gt;
        {&lt;br /&gt;
            public int SuspendCount;&lt;br /&gt;
            public uint VirtualSize;&lt;br /&gt;
            public uint ResidentSize;&lt;br /&gt;
            public TimeValue UserTime;&lt;br /&gt;
            public TimeValue SystemTime;&lt;br /&gt;
            public int Policy;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        [DllImport(&amp;quot;/usr/lib/system/libsystem_kernel.dylib&amp;quot;, CallingConvention = CallingConvention.Cdecl)]&lt;br /&gt;
        public static extern uint mach_task_self();&lt;br /&gt;
&lt;br /&gt;
        [DllImport(&amp;quot;/usr/lib/system/libsystem_kernel.dylib&amp;quot;, CallingConvention = CallingConvention.Cdecl)]&lt;br /&gt;
        public static extern int task_info(uint targetTaskID, int flavor, ref TaskBasicInfo taskInfo, ref int size);&lt;br /&gt;
&lt;br /&gt;
        static void Main(string[] args)&lt;br /&gt;
        {&lt;br /&gt;
            NSApplication.Init();&lt;br /&gt;
            //NSApplication.Main(args);&lt;br /&gt;
&lt;br /&gt;
            var taskInfo = new TaskBasicInfo();&lt;br /&gt;
            var taskid = mach_task_self();&lt;br /&gt;
            int size = Marshal.SizeOf(typeof(TaskBasicInfo));&lt;br /&gt;
            task_info(taskid, TASK_BASIC_INFO, ref taskInfo, ref size);&lt;br /&gt;
&lt;br /&gt;
            Console.WriteLine(taskInfo);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== 関連項目 ==&lt;br /&gt;
* [[Xamarin.Mac/本体のシリアル番号を取得する]]&lt;br /&gt;
&lt;br /&gt;
== 参考文献 ==&lt;br /&gt;
{{reflist}}&lt;br /&gt;
&lt;br /&gt;
{{stub}}&lt;br /&gt;
&lt;br /&gt;
[[category: Xamarin.Mac]]&lt;/div&gt;</summary>
		<author><name>108.162.226.154</name></author>
	</entry>
</feed>